Skip to content

Commit

Permalink
GH-390 pending fork block is in first index of known_blocks.ids not t…
Browse files Browse the repository at this point in the history
…he last index.
  • Loading branch information
heifner committed Aug 7, 2024
1 parent 63fec3e commit 1e5892b
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions plugins/net_plugin/net_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2400,7 +2400,7 @@ namespace eosio {
if (msg.known_blocks.ids.empty()) {
peer_wlog( c, "got a catch up with ids size = 0" );
} else {
const block_id_type& id = msg.known_blocks.ids.back();
const block_id_type& id = msg.known_blocks.ids.front();
peer_ilog( c, "notice_message, pending ${p}, blk_num ${n}, id ${id}...",
("p", msg.known_blocks.pending)("n", block_header::num_from_id(id))("id",id.str().substr(8,16)) );
if( !my_impl->dispatcher->have_block( id ) ) {
Expand Down Expand Up @@ -2690,12 +2690,7 @@ namespace eosio {
return;
}
if (msg.known_blocks.mode == normal) {
// known_blocks.ids is never > 1
if( !msg.known_blocks.ids.empty() ) {
if( msg.known_blocks.pending == 1 ) { // block id notify of 2.0.0, ignore
return;
}
}
return;
} else if (msg.known_blocks.mode != none) {
peer_wlog( c, "passed a notice_message with something other than a normal on none known_blocks" );
return;
Expand Down Expand Up @@ -3547,7 +3542,7 @@ namespace eosio {
}
if( msg.known_trx.mode != none ) {
if( logger.is_enabled( fc::log_level::debug ) ) {
const block_id_type& blkid = msg.known_blocks.ids.empty() ? block_id_type{} : msg.known_blocks.ids.back();
const block_id_type& blkid = msg.known_blocks.ids.empty() ? block_id_type{} : msg.known_blocks.ids.front();
peer_dlog( this, "this is a ${m} notice with ${n} pending blocks: ${num} ${id}...",
("m", modes_str( msg.known_blocks.mode ))("n", msg.known_blocks.pending)
("num", block_header::num_from_id( blkid ))("id", blkid.str().substr( 8, 16 )) );
Expand Down

0 comments on commit 1e5892b

Please sign in to comment.