From 5b8bc5e1404b55f674390a8fccc950c346d36abe Mon Sep 17 00:00:00 2001 From: Kevin Heifner Date: Sat, 10 Aug 2024 18:56:15 -0500 Subject: [PATCH] GH-499 Fix net_plugin requesting same range repeatedly --- plugins/net_plugin/net_plugin.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/plugins/net_plugin/net_plugin.cpp b/plugins/net_plugin/net_plugin.cpp index f6087e8059..72b5f4d193 100644 --- a/plugins/net_plugin/net_plugin.cpp +++ b/plugins/net_plugin/net_plugin.cpp @@ -2198,7 +2198,7 @@ namespace eosio { return; } - if( sync_state != lib_catchup || !sync_source ) { + if( sync_state != lib_catchup ) { set_state( lib_catchup ); sync_last_requested_num = 0; sync_next_expected_num = chain_info.lib_num + 1; @@ -2518,8 +2518,6 @@ namespace eosio { } else { if (blk_num == sync_next_expected_num) { ++sync_next_expected_num; - } else if (blk_num < sync_next_expected_num) { - sync_next_expected_num = blk_num + 1; } } if (blk_num >= sync_known_lib_num) { @@ -2542,8 +2540,7 @@ namespace eosio { } } else { // blk_applied if (blk_num >= sync_last_requested_num) { - // should not reach as should have hit the above when the block was received but not applied, but - // if we do then request blocks as we are still in lib_catchup + // Did not request blocks ahead, likely because too far ahead of head fc_dlog(logger, "Requesting blocks, head: ${h} fhead ${fh} blk_num: ${bn} sync_next_expected_num ${nen} " "sync_last_requested_num: ${lrn}, sync_last_requested_block: ${lrb}", ("h", my_impl->get_chain_head_num())("fh", my_impl->get_fork_head_num())