commit d1f7e4fe872e04cbec27b59f97c1fd240f288b87 Author: Damian Johnson atagar@torproject.org Date: Fri Jun 30 09:30:58 2017 -0700
Providing a signing key should imply we're signing
When the caller explicitly provides a signing key we should infer 'sign' to be true. Otherwise callers need to call...
RelayServerDescriptor.create(sign = True, signing_key = key)
... and that's stupid. Callers that provide a signing key *always* want the descriptor to be signed. Otherwise... well, their key won't be used. :P --- stem/descriptor/extrainfo_descriptor.py | 3 +++ stem/descriptor/server_descriptor.py | 3 +++ 2 files changed, 6 insertions(+)
diff --git a/stem/descriptor/extrainfo_descriptor.py b/stem/descriptor/extrainfo_descriptor.py index 27a75db..3a4a0f8 100644 --- a/stem/descriptor/extrainfo_descriptor.py +++ b/stem/descriptor/extrainfo_descriptor.py @@ -976,6 +976,9 @@ class RelayExtraInfoDescriptor(ExtraInfoDescriptor):
@classmethod def content(cls, attr = None, exclude = (), sign = False, signing_key = None): + if signing_key: + sign = True + if sign: if attr and 'router-signature' in attr: raise ValueError('Cannot sign the descriptor if a router-signature has been provided') diff --git a/stem/descriptor/server_descriptor.py b/stem/descriptor/server_descriptor.py index 1a1687f..42cbca6 100644 --- a/stem/descriptor/server_descriptor.py +++ b/stem/descriptor/server_descriptor.py @@ -802,6 +802,9 @@ class RelayDescriptor(ServerDescriptor):
@classmethod def content(cls, attr = None, exclude = (), sign = False, signing_key = None): + if signing_key: + sign = True + if attr is None: attr = {}