-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Description
In the Blockchain Reactor, peers self report their height and we track the highest one, but we can't validate it until we try to receive that block from that peer. Meanwhile, when we disconnect a peer, we don't update the max height. This means a rogue peer could tell us a ridiculously high height, then disconnect, and we will forever be stuck trying to sync to that height, and never switch to consensus.
We need to either update the pool.maxPeerHeight to the next highest reported height when we disconnect from the peer that reported the max height, or we need a different strategy for deciding to switch to consensus.
Note we should also check what happens when a rogue peer reports a high height, and then we try to get blocks that don't exist yet from good peers. Is there an attack here that could cause us to disconnect good peers?
Thanks @milosevic for catching this in #2621 (comment)