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
This commit is contained in:
Dimitrios Siganos 2024-01-23 09:47:43 +07:00 committed by GitHub
commit 7e58c50140
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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));
}