Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(net): solve 'no need sync' issue reported by nodes #4996

Merged
merged 2 commits into from
Feb 16, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
optimize chain inventory message processing logic
  • Loading branch information
xxo1shine committed Feb 15, 2023
commit a82003c212eea55aaa30dada189b60fd16bd19ae
Original file line number Diff line number Diff line change
Expand Up @@ -80,14 +80,15 @@ public void processMessage(PeerConnection peer, TronMessage msg) throws P2pExcep
} catch (NoSuchElementException e) {
logger.warn("Process ChainInventoryMessage failed, peer {}, isDisconnect:{}",
peer.getInetAddress(), peer.isDisconnect());
peer.setFetchAble(true);
return;
}
}

peer.setFetchAble(true);
if ((chainInventoryMessage.getRemainNum() == 0 && !peer.getSyncBlockToFetch().isEmpty())
|| (chainInventoryMessage.getRemainNum() != 0
&& peer.getSyncBlockToFetch().size() > NetConstants.SYNC_FETCH_BATCH_NUM)) {
peer.setFetchAble(true);
syncService.setFetchFlag(true);
} else {
syncService.syncNext(peer);
Expand Down