From e4c54300066b2dbe7d61c38dec8196ad98efdfe4 Mon Sep 17 00:00:00 2001 From: Kevin Heifner Date: Wed, 18 Sep 2019 15:15:09 -0400 Subject: [PATCH] get_block_id_for_num will throw unknown_block_exception when block num is not found --- plugins/net_plugin/net_plugin.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/plugins/net_plugin/net_plugin.cpp b/plugins/net_plugin/net_plugin.cpp index b9ef647f1f6..90b426781d3 100644 --- a/plugins/net_plugin/net_plugin.cpp +++ b/plugins/net_plugin/net_plugin.cpp @@ -1611,8 +1611,12 @@ namespace eosio { c->syncing = true; app().post( priority::medium, [chain_plug = my_impl->chain_plug, c, msg_head_num = msg.head_num, msg_head_id = msg.head_id]() { - controller& cc = chain_plug->chain(); - if( cc.get_block_id_for_num( msg_head_num ) != msg_head_id ) { + bool on_fork = true; + try { + controller& cc = chain_plug->chain(); + on_fork = cc.get_block_id_for_num( msg_head_num ) != msg_head_id; + } catch( ... ) {} + if( on_fork ) { c->strand.post( [c]() { request_message req; req.req_blocks.mode = catch_up;