From 7934881705d8f7958835942a1317918f94c44b98 Mon Sep 17 00:00:00 2001 From: Dimitrios Siganos Date: Sat, 27 Jan 2024 19:49:52 +0700 Subject: [PATCH] Fix unit test node.search_receivable_confirmed (#4408) --- nano/core_test/node.cpp | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/nano/core_test/node.cpp b/nano/core_test/node.cpp index 7cee7d7cbe..1b9a1edb4e 100644 --- a/nano/core_test/node.cpp +++ b/nano/core_test/node.cpp @@ -419,30 +419,25 @@ TEST (node, search_receivable_confirmed) auto node = system.add_node (node_config); nano::keypair key2; system.wallet (0)->insert_adhoc (nano::dev::genesis_key.prv); + auto send1 (system.wallet (0)->send_action (nano::dev::genesis_key.pub, key2.pub, node->config.receive_minimum.number ())); ASSERT_NE (nullptr, send1); + ASSERT_TIMELY (5s, nano::test::confirmed (*node, { send1 })); + auto send2 (system.wallet (0)->send_action (nano::dev::genesis_key.pub, key2.pub, node->config.receive_minimum.number ())); ASSERT_NE (nullptr, send2); - ASSERT_TIMELY (10s, node->active.empty ()); - bool confirmed (false); - system.deadline_set (5s); - while (!confirmed) - { - auto transaction (node->store.tx_begin_read ()); - confirmed = node->ledger.block_confirmed (transaction, send2->hash ()); - ASSERT_NO_ERROR (system.poll ()); - } + ASSERT_TIMELY (5s, nano::test::confirmed (*node, { send2 })); + { auto transaction (node->wallets.tx_begin_write ()); system.wallet (0)->store.erase (transaction, nano::dev::genesis_key.pub); } + system.wallet (0)->insert_adhoc (key2.prv); ASSERT_FALSE (system.wallet (0)->search_receivable (system.wallet (0)->wallets.tx_begin_read ())); - { - ASSERT_FALSE (node->active.active (send1->hash ())); - ASSERT_FALSE (node->active.active (send2->hash ())); - } - ASSERT_TIMELY_EQ (10s, node->balance (key2.pub), 2 * node->config.receive_minimum.number ()); + ASSERT_TIMELY (5s, !node->active.active (send1->hash ())); + ASSERT_TIMELY (5s, !node->active.active (send2->hash ())); + ASSERT_TIMELY_EQ (5s, node->balance (key2.pub), 2 * node->config.receive_minimum.number ()); } TEST (node, search_receivable_pruned)