kyuupichan / electrumx

Alternative implementation of spesmilo/electrum-server
Other
724 stars 733 forks source link

PeerManager coin onion peers are always selected for verifying availability #138

Closed fr3aker closed 7 years ago

fr3aker commented 7 years ago

While running with some debugging output for #135 I noticed that coin onion peers are always selected to retry connecting/verify availability. If tor_proxy.port is not None then last_tor_retry_time is never updated.

kyuupichan commented 7 years ago

If I understand you correctly you don't have a tor proxy?

This is all intended behaviour. If you don't have a tor proxy tor peers will have been dropped as they are unreachable. So testing if you've opened a Tor proxy since the last test uses well known tor peers from the coin list. The idea of the code is that if you start a tor proxy you shouldn't have to restart electrumx, it will notice itself with occasional retries.

fr3aker commented 7 years ago

I do have a tor proxy configured.

kyuupichan commented 7 years ago

Ok then tie proxy port is set, and there is no need to keep trying to discover one (the last tor retry time). I'm not really sure what the issue is saying is wrong.

fr3aker commented 7 years ago

When you have a tor proxy last_tor_retry_time is never updated and stays always 0.

kyuupichan commented 7 years ago

Sure. Why is that a problem?

fr3aker commented 7 years ago

This makes the if at peers.py#L443 always evaluate to True

kyuupichan commented 7 years ago

Ah yes that isn't intended.

kyuupichan commented 7 years ago

That should probably be testing if your proxy port is None instead. Do you agree? If so please submit a PR and I'll merge it.