From bb9ddeced94671396ab50df2c57113cb48120983 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Wo=CC=81jcik?= <3044353+pwojcikdev@users.noreply.github.com> Date: Sun, 27 Oct 2024 00:09:53 +0200 Subject: [PATCH] Block processor rolled back notifications on a backround thread --- nano/node/blockprocessor.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/nano/node/blockprocessor.cpp b/nano/node/blockprocessor.cpp index f0f634dc73..de314b20e9 100644 --- a/nano/node/blockprocessor.cpp +++ b/nano/node/blockprocessor.cpp @@ -197,8 +197,10 @@ void nano::block_processor::rollback_competitor (secure::write_transaction const logger.debug (nano::log::type::blockprocessor, "Blocks rolled back: {}", rollback_list.size ()); } - // Notify observers of the rolled back blocks - rolled_back.notify (rollback_list, fork_block.qualified_root ()); + // Notify observers of the rolled back blocks on a background thread while not holding the ledger write lock + workers.post ([this, rollback_list = std::move (rollback_list), root = fork_block.qualified_root ()] () { + rolled_back.notify (rollback_list, root); + }); } }