Skip to content

Commit

Permalink
Merge pull request #5831 from zeusoo001/f-sove-access-problem-fetch
Browse files Browse the repository at this point in the history
fix(net): solve the problem of concurrent access to fetchBlockInfo object
  • Loading branch information
lvs007 committed May 30, 2024
2 parents 76df76c + 089fa8a commit 4c670f9
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,10 @@ public void fetchBlock(List<Sha256Hash> sha256HashList, PeerConnection peer) {
sha256HashList.stream().filter(sha256Hash -> new BlockCapsule.BlockId(sha256Hash).getNum()
== chainBaseManager.getHeadBlockNum() + 1)
.findFirst().ifPresent(sha256Hash -> {
fetchBlockInfo = new FetchBlockInfo(sha256Hash, peer, System.currentTimeMillis());
long now = System.currentTimeMillis();
fetchBlockInfo = new FetchBlockInfo(sha256Hash, peer, now);
logger.info("Set fetchBlockInfo, block: {}, peer: {}, time: {}", sha256Hash,
fetchBlockInfo.getPeer().getInetAddress(), fetchBlockInfo.getTime());
peer.getInetAddress(), now);
});
}

Expand Down

0 comments on commit 4c670f9

Please sign in to comment.