diff --git a/plugins/net_plugin/net_plugin.cpp b/plugins/net_plugin/net_plugin.cpp index 17e9b19c224..35afe6aa3a0 100644 --- a/plugins/net_plugin/net_plugin.cpp +++ b/plugins/net_plugin/net_plugin.cpp @@ -2902,7 +2902,15 @@ namespace eosio { peer_requested.reset(); flush_queues(); } else { - peer_requested = peer_sync_state( msg.start_block, msg.end_block, msg.start_block-1); + if (peer_requested) { + // This happens when peer already requested some range and sync is still in progress + // It could be higher in case of peer requested head catchup and current request is lib catchup + // So to make sure peer will receive all requested blocks we assign end_block to highest value + peer_requested->end_block = std::max(msg.end_block, peer_requested->end_block); + } + else { + peer_requested = peer_sync_state( msg.start_block, msg.end_block, msg.start_block-1); + } enqueue_sync_block(); } }