Skip to content
This repository has been archived by the owner on Jul 1, 2021. It is now read-only.

Commit

Permalink
Revert "Blacklist mildly naughty peers (don't disconnect)"
Browse files Browse the repository at this point in the history
This reverts commit 8d0fd7649d26825b88f2cf9442053a1a8f391a8a.
  • Loading branch information
carver committed Jun 7, 2019
1 parent d76ed0b commit 750c5df
Showing 1 changed file with 5 additions and 15 deletions.
20 changes: 5 additions & 15 deletions trinity/sync/common/headers.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
FrozenSet,
Generic,
Sequence,
Set,
Tuple,
Type,
)
Expand Down Expand Up @@ -81,8 +80,6 @@ class SkeletonSyncer(BaseService, Generic[TChainPeer]):

_fetched_headers: 'asyncio.Queue[Tuple[BlockHeader, ...]]'

_blacklist: Set[TChainPeer] = set()

def __init__(self,
chain: BaseAsyncChain,
db: BaseAsyncHeaderDB,
Expand Down Expand Up @@ -127,17 +124,14 @@ async def _quietly_fetch_full_skeleton(self) -> None:
await self._fetch_full_skeleton()
except ValidationError as exc:
self.logger.debug(
"Exiting sync %s due to validation error: %s",
"Exiting sync and booting %s due to validation error: %s",
self.peer,
exc,
)
# TODO bring back booting eventually?
#await self.peer.disconnect(DisconnectReason.subprotocol_error)
self._blacklist.add(self.peer)
await self.peer.disconnect(DisconnectReason.subprotocol_error)
except TimeoutError:
self.logger.warning("Timeout waiting for header batch from %s, halting sync", self.peer)
#await self.peer.disconnect(DisconnectReason.timeout)
self._blacklist.add(self.peer)
await self.peer.disconnect(DisconnectReason.timeout)

async def _fetch_full_skeleton(self) -> None:
"""
Expand Down Expand Up @@ -454,16 +448,14 @@ async def _fetch_headers_from(
return tuple()
except TimeoutError:
self.logger.warning("Timeout waiting for header batch from %s, aborting sync", peer)
#await peer.disconnect(DisconnectReason.timeout)
self._blacklist.add(self.peer)
await peer.disconnect(DisconnectReason.timeout)
return tuple()
except ValidationError as err:
self.logger.warning(
"Invalid header response sent by peer %s disconnecting: %s",
peer, err,
)
#await peer.disconnect(DisconnectReason.subprotocol_error)
self._blacklist.add(self.peer)
await peer.disconnect(DisconnectReason.subprotocol_error)
return tuple()

if not headers:
Expand Down Expand Up @@ -833,8 +825,6 @@ async def _build_skeleton(self) -> None:
"""
# iterator yields the peer with the highest TD in our pool
async for peer in self._tip_monitor.wait_tip_info():
if peer in SkeletonSyncer._blacklist:
continue
try:
await self._validate_peer_is_ahead(peer)
except _PeerBehind:
Expand Down

0 comments on commit 750c5df

Please sign in to comment.