CityOfZion / neo-python

Python Node and SDK for the NEO 2.x blockchain. For NEO 3.x go to our successor project neo-mamba
https://neo-python.readthedocs.io/en/latest/
MIT License
313 stars 189 forks source link

Minor update to network recovery #1024

Closed ixje closed 4 years ago

ixje commented 4 years ago

What current issue(s) does this address, or what feature is it adding? A recent discussion on slack showed that an edge case can exist in which neo-python runs out of node address to fill our desired connection slots and cannot recover. In such a scenario neo-python recycles all addresses it ever learned over the network (both bad and good) and tries to find a working node. There is a threshold on how long it tries before recycling again. This threshold is time based, not address list exhaustive. The recycling logic always produces the same list, therefore if the first n addresses in the list are bad, we can hit the time threshold and recycle before finding a good node.

How did you solve this problem? We randomize the addresses just after recycling them. This should eventually result in being able to restore.

How did you make sure your solution works?

Are there any special changes in the code that we should be aware of?

Please check the following, if applicable:

coveralls commented 4 years ago

Coverage Status

Coverage decreased (-0.003%) to 85.311% when pulling ce6dd37201ce1c20af2f8781abad62305f8b36a1 on ixje:update-network-recovery into cc6fd894f6c7c395a02e736e2a2b9c374b58a39a on CityOfZion:development.