@@ -41,9 +41,6 @@ public class FetchBlockService {
4141
4242 private final long fetchTimeOut = CommonParameter .getInstance ().fetchBlockTimeout ;
4343
44- private static final int BLOCK_FETCH_TIME_OUT_LIMIT =
45- 2 * Parameter .ChainConstant .BLOCK_PRODUCED_INTERVAL ;
46-
4744 private static final double BLOCK_FETCH_LEFT_TIME_PERCENT = 0.5 ;
4845
4946 private final ScheduledExecutorService fetchBlockWorkerExecutor =
@@ -76,12 +73,9 @@ public void fetchBlock(List<Sha256Hash> sha256HashList, PeerConnection peer) {
7673 sha256HashList .stream ().filter (sha256Hash -> new BlockCapsule .BlockId (sha256Hash ).getNum ()
7774 == chainBaseManager .getHeadBlockNum () + 1 )
7875 .findFirst ().ifPresent (sha256Hash -> {
79- if (System .currentTimeMillis () - chainBaseManager .getHeadBlockTimeStamp ()
80- < BLOCK_FETCH_TIME_OUT_LIMIT ) {
81- fetchBlockInfo = new FetchBlockInfo (sha256Hash , peer , System .currentTimeMillis ());
82- logger .info ("Set fetchBlockInfo, block: {}, peer: {}, time: {}" , sha256Hash ,
83- fetchBlockInfo .getPeer ().getInetAddress (), fetchBlockInfo .getTime ());
84- }
76+ fetchBlockInfo = new FetchBlockInfo (sha256Hash , peer , System .currentTimeMillis ());
77+ logger .info ("Set fetchBlockInfo, block: {}, peer: {}, time: {}" , sha256Hash ,
78+ fetchBlockInfo .getPeer ().getInetAddress (), fetchBlockInfo .getTime ());
8579 });
8680 }
8781
@@ -99,13 +93,6 @@ private void fetchBlockProcess(FetchBlockInfo fetchBlock) {
9993 if (null == fetchBlock ) {
10094 return ;
10195 }
102- if (System .currentTimeMillis () - chainBaseManager .getHeadBlockTimeStamp ()
103- >= BLOCK_FETCH_TIME_OUT_LIMIT ) {
104- this .fetchBlockInfo = null ;
105- logger .info ("Clear fetchBlockInfo due to {} ms past head block time" ,
106- BLOCK_FETCH_TIME_OUT_LIMIT );
107- return ;
108- }
10996 Item item = new Item (fetchBlock .getHash (), InventoryType .BLOCK );
11097 Optional <PeerConnection > optionalPeerConnection = tronNetDelegate .getActivePeer ().stream ()
11198 .filter (PeerConnection ::isIdle )
0 commit comments