diff --git a/nano/core_test/active_transactions.cpp b/nano/core_test/active_transactions.cpp index bd10e027..8e9a0113 100644 --- a/nano/core_test/active_transactions.cpp +++ b/nano/core_test/active_transactions.cpp @@ -248,7 +248,7 @@ TEST (active_transactions, keep_local) auto send4 (wallet.send_action (nano::test_genesis_key.pub, key4.pub, node.config.receive_minimum.number ())); auto send5 (wallet.send_action (nano::test_genesis_key.pub, key5.pub, node.config.receive_minimum.number ())); auto send6 (wallet.send_action (nano::test_genesis_key.pub, key6.pub, node.config.receive_minimum.number ())); - system.deadline_set (10s); + system.deadline_set (5s); // should not drop wallet created transactions while (node.active.size () != 6) { @@ -264,16 +264,13 @@ TEST (active_transactions, keep_local) } } auto open1 (std::make_shared (key1.pub, 0, key1.pub, node.config.receive_minimum.number (), send1->hash (), key1.prv, key1.pub, *system.work.generate (key1.pub))); - node.process_active (open1); - node.active.start (open1); auto open2 (std::make_shared (key2.pub, 0, key2.pub, node.config.receive_minimum.number (), send2->hash (), key2.prv, key2.pub, *system.work.generate (key2.pub))); - node.process_active (open2); - node.active.start (open2); auto open3 (std::make_shared (key3.pub, 0, key3.pub, node.config.receive_minimum.number (), send3->hash (), key3.prv, key3.pub, *system.work.generate (key3.pub))); + node.process_active (open1); + node.process_active (open2); node.process_active (open3); - node.active.start (open3); - ASSERT_EQ (3, node.active.size ()); - system.deadline_set (10s); + node.block_processor.flush (); + system.deadline_set (5s); // bound elections, should drop after one loop while (node.active.size () != node_config.active_elections_size) { diff --git a/nano/node/blockprocessor.cpp b/nano/node/blockprocessor.cpp index fa08451f..5e1fbb5c 100644 --- a/nano/node/blockprocessor.cpp +++ b/nano/node/blockprocessor.cpp @@ -360,13 +360,15 @@ void nano::block_processor::process_batch (nano::unique_lock & lock_ void nano::block_processor::process_live (nano::block_hash const & hash_a, std::shared_ptr block_a, const bool watch_work_a) { - // Start collecting quorum on block - node.active.start (block_a, false); - //add block to watcher if desired after block has been added to active + // Add to work watcher to prevent dropping the election if (watch_work_a) { node.wallets.watcher->add (block_a); } + + // Start collecting quorum on block + node.active.start (block_a, false); + // Announce block contents to the network node.network.flood_block (block_a, false); if (node.config.enable_voting && node.wallets.rep_counts ().voting > 0) diff --git a/nano/node/wallet.cpp b/nano/node/wallet.cpp index 2de35066..386c48b1 100644 --- a/nano/node/wallet.cpp +++ b/nano/node/wallet.cpp @@ -1141,8 +1141,7 @@ bool nano::wallet::action_complete (std::shared_ptr const & block_a } if (!error) { - wallets.watcher->add (block_a); - error = wallets.node.process_local (block_a).code != nano::process_result::progress; + error = wallets.node.process_local (block_a, true).code != nano::process_result::progress; } if (!error && generate_work_a) {