Remove exception for onion peers
Like clearnet peers, they are only returned in server.peers.subscribe if there was a successful connection.
This commit is contained in:
parent
9dd5541f82
commit
40fa79da63
@ -53,13 +53,8 @@ The server should craft its response in a way that reduces the
|
||||
effectiveness of sybil attacks and peer spamming.
|
||||
|
||||
The response should only include peers it has successfully connected
|
||||
to recently. If Tor routing is not available, so their existence
|
||||
cannot be verified, the response should include some hard-coded onion
|
||||
peers so that clients always have a choice of onion servers.
|
||||
|
||||
Only reporting recent good peers ensures that those that have gone
|
||||
offline will not be passed around for long (ignoring for hard-coded
|
||||
onion peer exception).
|
||||
to recently. Only reporting recent good peers ensures that those that
|
||||
have gone offline will not be passed around for long.
|
||||
|
||||
In ElectrumX, "recently" is taken to be the last 24 hours. Only one
|
||||
peer from each IPv4/16 netmask is returned, and the number of onion
|
||||
|
||||
@ -259,7 +259,6 @@ class PeerManager(util.LoggedClass):
|
||||
# IP address that was connected to. Adding a peer will evict
|
||||
# any other peers with the same host name or IP address.
|
||||
self.peers = set()
|
||||
self.onion_peers = []
|
||||
self.permit_onion_peer_time = time.time()
|
||||
self.proxy = SocksProxy(env.tor_proxy_host, env.tor_proxy_port,
|
||||
loop=self.loop)
|
||||
@ -417,7 +416,6 @@ class PeerManager(util.LoggedClass):
|
||||
peers.update(bucket_peers[:2])
|
||||
|
||||
# Add up to 20% onion peers (but up to 10 is OK anyway)
|
||||
onion_peers = onion_peers or self.onion_peers
|
||||
random.shuffle(onion_peers)
|
||||
max_onion = 50 if is_tor else max(10, len(peers) // 4)
|
||||
|
||||
@ -460,8 +458,6 @@ class PeerManager(util.LoggedClass):
|
||||
'''Import hard-coded peers from a file or the coin defaults.'''
|
||||
self.add_peers(self.myselves)
|
||||
coin_peers = self.env.coin.PEERS
|
||||
self.onion_peers = [Peer.from_real_name(rn, 'coins.py')
|
||||
for rn in coin_peers if '.onion ' in rn]
|
||||
|
||||
# If we don't have many peers in the peers file, add
|
||||
# hard-coded ones
|
||||
|
||||
Loading…
Reference in New Issue
Block a user