diff --git a/libraries/chain/controller.cpp b/libraries/chain/controller.cpp index bc8ab5cd4e..54bdc46176 100644 --- a/libraries/chain/controller.cpp +++ b/libraries/chain/controller.cpp @@ -1698,7 +1698,9 @@ struct controller_impl { auto pending_head = forkdb.pending_head(); if( pending_head && blog_head && start_block_num <= blog_head->block_num() ) { - ilog( "fork database head ${h}, root ${r}", ("h", pending_head->block_num())( "r", forkdb.root()->block_num() ) ); + ilog("fork database head ${hn}:${h}, root ${rn}:${r}", + ("hn", pending_head->block_num())("h", pending_head->id()) + ("rn", forkdb.root()->block_num())("r", forkdb.root()->id())); if( pending_head->block_num() < chain_head.block_num() || chain_head.block_num() < forkdb.root()->block_num() ) { ilog( "resetting fork database with new last irreversible block as the new root: ${id}", ("id", chain_head.id()) ); fork_db_reset_root_to_chain_head(); diff --git a/libraries/chain/fork_database.cpp b/libraries/chain/fork_database.cpp index ff8d81e253..df3e70816e 100644 --- a/libraries/chain/fork_database.cpp +++ b/libraries/chain/fork_database.cpp @@ -209,6 +209,9 @@ namespace eosio::chain { void fork_database_impl::close_impl(std::ofstream& out) { assert(!!head && !!root); // if head or root are null, we don't save and shouldn't get here + ilog("Writing fork_database with root ${rn}:${r} and head ${hn}:${h}", + ("rn", root->block_num())("r", root->id())("hn", head->block_num())("h", head->id())); + fc::raw::pack( out, *root ); uint32_t num_blocks_in_fork_db = index.size(); @@ -719,8 +722,7 @@ namespace eosio::chain { auto in_use_value = in_use.load(); // check that fork_dbs are in a consistent state if (!legacy_valid && !savanna_valid) { - wlog( "fork_database is in a bad state when closing; not writing out '${filename}', legacy_valid=${l}, savanna_valid=${s}", - ("filename", fork_db_file)("l", legacy_valid)("s", savanna_valid) ); + ilog("No fork_database to persist"); return; } else if (legacy_valid && savanna_valid && in_use_value == in_use_t::savanna) { legacy_valid = false; // don't write legacy if not needed, we delay 'clear' of legacy until close @@ -729,6 +731,7 @@ namespace eosio::chain { (savanna_valid && (in_use_value == in_use_t::savanna)) || (legacy_valid && savanna_valid && (in_use_value == in_use_t::both)) ); + ilog("Persisting to fork_database file: ${f}", ("f", fork_db_file)); std::ofstream out( fork_db_file.generic_string().c_str(), std::ios::out | std::ios::binary | std::ofstream::trunc ); fc::raw::pack( out, magic_number );