Skip to content

Commit

Permalink
Improve blocks lack handling
Browse files Browse the repository at this point in the history
  • Loading branch information
mkalinin committed Sep 30, 2015
1 parent d932322 commit e989398
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
Expand Up @@ -282,6 +282,7 @@ public void changeState(SyncStateName newState) {
if(++blocksLackHits < BLOCKS_LACK_MAX_HITS) {
return;
}
blocksLackHits = 0; // reset
}
syncState = newState;
}
Expand Down
Expand Up @@ -413,12 +413,14 @@ private void removeUselessPeers() {
List<Channel> removed = new ArrayList<>();
for (Channel peer : pool) {
if (peer.hasBlocksLack()) {
logger.info("Peer {}: has no more blocks, removing", Utils.getNodeIdShort(peer.getPeerId()));
logger.info("{}: has no more blocks, ban", peer);
removed.add(peer);
updateLowerUsefulDifficulty(peer.getTotalDifficulty());
}
}
pool.removeAll(removed);
for (Channel peer : removed) {
pool.ban(peer);
}
}

private void fillUpPeersPool() {
Expand Down

0 comments on commit e989398

Please sign in to comment.