diff --git a/nano/node/node.cpp b/nano/node/node.cpp index 589112e7b0..18d9da21d5 100644 --- a/nano/node/node.cpp +++ b/nano/node/node.cpp @@ -570,7 +570,9 @@ void nano::node::process_active (std::shared_ptr const & incoming) [[nodiscard]] nano::block_status nano::node::process (store::write_transaction const & transaction, std::shared_ptr block) { - return ledger.process (transaction, block); + auto status = ledger.process (transaction, block); + logger.debug (nano::log::type::node, "Directly processed block: {} (status: {})", block->hash ().to_string (), to_string (status)); + return status; } nano::block_status nano::node::process (std::shared_ptr block) diff --git a/nano/test_common/testutil.cpp b/nano/test_common/testutil.cpp index c7b126f2ad..31b8bbb3d4 100644 --- a/nano/test_common/testutil.cpp +++ b/nano/test_common/testutil.cpp @@ -339,3 +339,14 @@ void nano::test::print_all_blocks (nano::node & node) std::cout << b->to_json (); } } + +std::vector> nano::test::all_blocks (nano::node & node) +{ + auto transaction = node.store.tx_begin_read (); + std::vector> result; + for (auto it = node.store.block.begin (transaction), end = node.store.block.end (); it != end; ++it) + { + result.push_back (it->second.block); + } + return result; +} \ No newline at end of file diff --git a/nano/test_common/testutil.hpp b/nano/test_common/testutil.hpp index a2706dc3f8..36ec9a3143 100644 --- a/nano/test_common/testutil.hpp +++ b/nano/test_common/testutil.hpp @@ -425,5 +425,10 @@ namespace test * \brief Debugging function to print all blocks in a node. Intented to be used to debug unit tests. */ void print_all_blocks (nano::node & node); + + /** + * Returns all blocks in the ledger + */ + std::vector> all_blocks (nano::node &); } } \ No newline at end of file