Run node::process_confirmed from worker thread (#3958)
This does database lookup and was called from vote processor thread
This commit is contained in:
parent
9dde6c897a
commit
37860c6476
2 changed files with 6 additions and 4 deletions
|
|
@ -1219,9 +1219,9 @@ TEST (active_transactions, activate_inactive)
|
||||||
ASSERT_NE (nullptr, election);
|
ASSERT_NE (nullptr, election);
|
||||||
election->force_confirm ();
|
election->force_confirm ();
|
||||||
|
|
||||||
ASSERT_TIMELY (3s, !node.confirmation_height_processor.is_processing_added_block (send2->hash ()));
|
ASSERT_TIMELY (5s, !node.confirmation_height_processor.is_processing_added_block (send2->hash ()));
|
||||||
ASSERT_TRUE (node.block_confirmed (send2->hash ()));
|
ASSERT_TIMELY (5s, node.block_confirmed (send2->hash ()));
|
||||||
ASSERT_TRUE (node.block_confirmed (send->hash ()));
|
ASSERT_TIMELY (5s, node.block_confirmed (send->hash ()));
|
||||||
|
|
||||||
ASSERT_EQ (1, node.stats.count (nano::stat::type::confirmation_observer, nano::stat::detail::inactive_conf_height, nano::stat::dir::out));
|
ASSERT_EQ (1, node.stats.count (nano::stat::type::confirmation_observer, nano::stat::detail::inactive_conf_height, nano::stat::dir::out));
|
||||||
ASSERT_EQ (1, node.stats.count (nano::stat::type::confirmation_observer, nano::stat::detail::active_quorum, nano::stat::dir::out));
|
ASSERT_EQ (1, node.stats.count (nano::stat::type::confirmation_observer, nano::stat::detail::active_quorum, nano::stat::dir::out));
|
||||||
|
|
|
||||||
|
|
@ -53,8 +53,10 @@ void nano::election::confirm_once (nano::unique_lock<nano::mutex> & lock_a, nano
|
||||||
status.type = type_a;
|
status.type = type_a;
|
||||||
auto const status_l = status;
|
auto const status_l = status;
|
||||||
lock_a.unlock ();
|
lock_a.unlock ();
|
||||||
node.process_confirmed (status_l);
|
|
||||||
node.background ([node_l = node.shared (), status_l, confirmation_action_l = confirmation_action] () {
|
node.background ([node_l = node.shared (), status_l, confirmation_action_l = confirmation_action] () {
|
||||||
|
node_l->process_confirmed (status_l);
|
||||||
|
|
||||||
if (confirmation_action_l)
|
if (confirmation_action_l)
|
||||||
{
|
{
|
||||||
confirmation_action_l (status_l.winner);
|
confirmation_action_l (status_l.winner);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue