Skip to content

Commit

Permalink
Fix rpc receivable unconfirmed and rpc.accounts_receivable_confirmed (#…
Browse files Browse the repository at this point in the history
…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
  • Loading branch information
dsiganos authored Jan 23, 2024
1 parent 06d8b4e commit 7e58c50
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions nano/rpc_test/receivable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
Expand Down Expand Up @@ -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;
Expand All @@ -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));
}

0 comments on commit 7e58c50

Please sign in to comment.