fix check for moving backwards

This commit is contained in:
Robert Habermeier 2016-12-16 23:53:36 +01:00
parent 2c0f456e4d
commit be914ddfc7

View File

@ -282,7 +282,7 @@ impl<L: LightChainClient> Handler for LightSync<L> {
trace!(target: "sync", "Announcement from peer {}: new chain head {:?}, reorg depth {}", trace!(target: "sync", "Announcement from peer {}: new chain head {:?}, reorg depth {}",
ctx.peer(), (announcement.head_hash, announcement.head_num), announcement.reorg_depth); ctx.peer(), (announcement.head_hash, announcement.head_num), announcement.reorg_depth);
if last_td < announcement.head_td { if last_td > announcement.head_td {
trace!(target: "sync", "Peer {} moved backwards.", ctx.peer()); trace!(target: "sync", "Peer {} moved backwards.", ctx.peer());
self.peers.write().remove(&ctx.peer()); self.peers.write().remove(&ctx.peer());
ctx.disconnect_peer(ctx.peer()); ctx.disconnect_peer(ctx.peer());