Closed juga0 closed 3 years ago
Hi Juga. Unless I'm missing something when a 'hibernating' line is not present the attribute should be (and is) False
. An attribute's default value when the line is not present is the first value of the following tuple...
https://github.com/torproject/stem/blob/master/stem/descriptor/server_descriptor.py#L538
When I parse the descriptor you have above I get the correct result...
from stem.descriptor.server_descriptor import RelayDescriptor
DESC = """\
router test000a 127.0.0.1 5000 0 7000
identity-ed25519
-----BEGIN ED25519 CERT-----
AQQABty7Ad6v2gm3qpOPpSl00Sx2otQB1sB5bkSm9wBkZPjC3soFAQAgBABP1YTv
lYqSmrtt/Md7+gzmiQ12L5Lx6eChjiwJiWrxHAMEtEM+FUhQfMJVww4Vg4P41otI
DLy8bIb6U4BJa+Gm3CBuBFXj0n/SUJYsLB9u7d3YiqWgRDgcXp3xsBek+wg=
-----END ED25519 CERT-----
master-key-ed25519 T9WE75WKkpq7bfzHe/oM5okNdi+S8engoY4sCYlq8Rw
or-address [::]:5000
platform Tor 0.4.5.7-dev on Linux
... etc...
""""
desc = RelayDescriptor.from_str(DESC)
print('hibernating: %s' % desc.hibernating)
% python demo.py
hibernating: False
Feel free to reopen if I'm missing something.
Thanks for pointing me at that part of the code i didn't see.
Yes, it works as expected using your code.
I guess the issue was that chutney set relays to hibernate in the previous run, when stopping them.
Thanks!
While working on this sbws' patch, using the
ServerDescriptor
hibernating
attribute, I realized that it's always returning 1. You can see this in the Gitlab job where integration tests are running with chutney.Looking at stem's code (https://github.com/torproject/stem/blob/master/stem/descriptor/server_descriptor.py#L336), it's returning 1 when the item is not found, but the spec says
at most once
andif the value is 1
, so i interpret that if it's not present, it's not hibernating.Here an example of a relay from descriptors cached by chutney without that item: