From 7e58c50140921031ebb1f59a7fc8a3594ec6022b Mon Sep 17 00:00:00 2001 From: Dimitrios Siganos Date: Tue, 23 Jan 2024 09:47:43 +0700 Subject: [PATCH] Fix rpc receivable unconfirmed and rpc.accounts_receivable_confirmed (#4387) * Fix rpc.receivable_unconfirmed In RPC speak, cofnirmed is equivalent to cemented and in this case the test only check if the election is not active, which indirectly but not directly implies that the election is confirmed. But even then it is not necesarily cemented since that is an extra background step. We should check for cemented with the function nano::test:confirmed(), which is also confusing... * Also fix rpc.accounts_receivable_confirmed --- nano/rpc_test/receivable.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/nano/rpc_test/receivable.cpp b/nano/rpc_test/receivable.cpp index 61dd352d..09d7816d 100644 --- a/nano/rpc_test/receivable.cpp +++ b/nano/rpc_test/receivable.cpp @@ -146,7 +146,7 @@ TEST (rpc, receivable_unconfirmed) request.put ("include_only_confirmed", "false"); ASSERT_TRUE (check_block_response_count (system, rpc_ctx, request, 1)); ASSERT_TRUE (nano::test::start_elections (system, *node, { block1->hash () }, true)); - ASSERT_TIMELY (5s, !node->active.active (*block1)); + ASSERT_TIMELY (5s, nano::test::confirmed (*node, { block1 })); request.put ("include_only_confirmed", "true"); ASSERT_TRUE (check_block_response_count (system, rpc_ctx, request, 1)); } @@ -533,7 +533,6 @@ TEST (rpc, accounts_receivable_confirmed) auto node = add_ipc_enabled_node (system, config); auto chain = nano::test::setup_chain (system, *node, 1, nano::dev::genesis_key, false); auto block1 = chain[0]; - ASSERT_TIMELY (5s, !node->active.active (*block1)); auto const rpc_ctx = add_rpc (system, node); boost::property_tree::ptree request; @@ -550,7 +549,7 @@ TEST (rpc, accounts_receivable_confirmed) request.put ("include_only_confirmed", "false"); ASSERT_TRUE (check_block_response_count (system, rpc_ctx, request, 1)); ASSERT_TRUE (nano::test::start_elections (system, *node, { block1->hash () }, true)); - ASSERT_TIMELY (5s, !node->active.active (*block1)); + ASSERT_TIMELY (5s, nano::test::confirmed (*node, { block1 })); request.put ("include_only_confirmed", "true"); ASSERT_TRUE (check_block_response_count (system, rpc_ctx, request, 1)); }