From 215c3988f3829906657ed976f82d7e860db2e2c0 Mon Sep 17 00:00:00 2001 From: ABW Date: Mon, 14 Oct 2024 20:32:19 +0200 Subject: [PATCH] prevent unlinkable_block_exception from printing full block content into log - just the block header is sufficient in that case --- libraries/plugins/chain/chain_plugin.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/libraries/plugins/chain/chain_plugin.cpp b/libraries/plugins/chain/chain_plugin.cpp index 439fda0172..83fb82828d 100644 --- a/libraries/plugins/chain/chain_plugin.cpp +++ b/libraries/plugins/chain/chain_plugin.cpp @@ -944,6 +944,7 @@ bool chain_plugin_impl::push_block( const block_flow_control& block_ctrl, uint32 { const std::shared_ptr& full_block = block_ctrl.get_full_block(); const signed_block& new_block = full_block->get_block(); + const signed_block_header& new_block_header = new_block; uint32_t block_num = full_block->get_block_num(); if( checkpoints.size() && checkpoints.rbegin()->second != block_id_type() ) @@ -993,7 +994,12 @@ bool chain_plugin_impl::push_block( const block_flow_control& block_ctrl, uint32 db.notify_finish_push_block( full_block ); block_ctrl.on_end_of_apply_block(); } - FC_CAPTURE_AND_RETHROW((new_block)) + catch( unlinkable_block_exception& er ) + { + // we only need header (if anything at all) in most common case of block from unknown fork + FC_RETHROW_EXCEPTION( er, warn, "", FC_FORMAT_ARG_PARAMS( (new_block_header) ) ); + } + FC_CAPTURE_AND_RETHROW( (new_block) ) db.check_free_memory( false, full_block->get_block_num() ); });