Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

Commit

Permalink
Merge pull request #988 from EOSIO/p2p-stat-271-gh916-5
Browse files Browse the repository at this point in the history
fix for failure to start producing blocks #916
  • Loading branch information
heifner authored Dec 21, 2017
2 parents 9654703 + c3f52e2 commit 233ba4e
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions plugins/net_plugin/net_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1222,6 +1222,10 @@ namespace eosio {
}

void sync_manager::start_sync( connection_ptr c, uint32_t target) {
if( target > sync_known_lib_num) {
sync_known_lib_num = target;
}

if (!sync_required()) {
uint32_t bnum = chain_plug->chain().last_irreversible_block_num();
uint32_t hnum = chain_plug->chain().head_block_num();
Expand All @@ -1234,9 +1238,7 @@ namespace eosio {
active = true;

ilog( "Catching up with chain, our last req is ${cc}, theirs is ${t} peer ${p}", ( "cc",sync_last_requested_num)("t",target)("p",c->peer_name()));
if( target > sync_known_lib_num) {
sync_known_lib_num = target;
}

if( c->sync_receiving && c->sync_receiving->end_block > 0) {
ilog("connection already has end block ${eb}",("eb",c->sync_receiving->end_block));
return;
Expand Down Expand Up @@ -1563,7 +1565,8 @@ namespace eosio {
fc_dlog(logger, "sync check state 2");
if ( msg.generation > 1 ) {
notice_message note;
note.known_trx.mode = none;
note.known_trx.pending = head;
note.known_trx.mode = last_irr_catch_up;
note.known_blocks.mode = last_irr_catch_up;
note.known_blocks.pending = lib_num;
c->enqueue( note );
Expand Down Expand Up @@ -1654,6 +1657,7 @@ namespace eosio {
case none:
break;
case last_irr_catch_up: {
c->last_handshake.head_num = msg.known_trx.pending;
req.req_trx.mode = none;
fwd.known_trx.mode = none;
break;
Expand Down Expand Up @@ -1704,7 +1708,10 @@ namespace eosio {
break;
}
case last_irr_catch_up : {
c->last_handshake.last_irreversible_block_num = msg.known_trx.pending;
sync_master->reset_lib_num ();
if (!c->sync_receiving ) {

sync_master->start_sync(c, msg.known_blocks.pending);
}
break;
Expand Down

0 comments on commit 233ba4e

Please sign in to comment.