Skip to content

Commit

Permalink
Some work on tests.
Browse files Browse the repository at this point in the history
Fixing ledger test asserts

Separating non-ledger queries.

Fixing more ledger tests

More test fixes.

Converting receivable mapping to sorted to support receivable_any query on unconfirmed blocks.

More test fixes.

Fixing most ledger tests.

Rename ledger::block_confirmed to ledger::confirmed. Add ledger::unconfirmed.

Add ledger::unconfirmed query for account numbers.

Updating scheduler next block calculation.

Update node::process_confirmed

Fix node tests and rollback logic.

Abstracting queries for root successor for use in request_aggregator.

Fixing more tests.

Expand pending block searching to unconfirmed blocks.

Fixing bootstrap tests.
  • Loading branch information
clemahieu committed Mar 5, 2024
1 parent e614b88 commit eac2780
Show file tree
Hide file tree
Showing 28 changed files with 457 additions and 242 deletions.
1 change: 0 additions & 1 deletion nano/core_test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ add_executable(
bootstrap_ascending.cpp
bootstrap_server.cpp
cli.cpp
confirmation_height.cpp
confirmation_solicitor.cpp
conflicts.cpp
difficulty.cpp
Expand Down
4 changes: 2 additions & 2 deletions nano/core_test/active_transactions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ TEST (active_transactions, inactive_votes_cache)
node.vote_processor.vote (vote, std::make_shared<nano::transport::inproc::channel> (node, node));
ASSERT_TIMELY_EQ (5s, node.vote_cache.size (), 1);
node.process_active (send);
ASSERT_TIMELY (5s, node.ledger.block_confirmed (node.store.tx_begin_read (), send->hash ()));
ASSERT_TIMELY (5s, node.ledger.confirmed (node.store.tx_begin_read (), send->hash ()));
ASSERT_EQ (1, node.stats.count (nano::stat::type::election, nano::stat::detail::vote_cached));
}

Expand Down Expand Up @@ -1026,7 +1026,7 @@ TEST (active_transactions, confirmation_consistency)
auto block (system.wallet (0)->send_action (nano::dev::genesis_key.pub, nano::public_key (), node.config.receive_minimum.number ()));
ASSERT_NE (nullptr, block);
system.deadline_set (5s);
while (!node.ledger.block_confirmed (node.store.tx_begin_read (), block->hash ()))
while (!node.ledger.confirmed (node.store.tx_begin_read (), block->hash ()))
{
node.scheduler.priority.activate (nano::dev::genesis_key.pub, node.store.tx_begin_read ());
ASSERT_NO_ERROR (system.poll (5ms));
Expand Down
8 changes: 6 additions & 2 deletions nano/core_test/bootstrap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@ TEST (bulk_pull, end_not_owned)
nano::test::system system (1);
nano::keypair key2;
system.wallet (0)->insert_adhoc (nano::dev::genesis_key.prv);
ASSERT_NE (nullptr, system.wallet (0)->send_action (nano::dev::genesis_key.pub, key2.pub, 100));
auto block = system.wallet (0)->send_action (nano::dev::genesis_key.pub, key2.pub, 100);
ASSERT_NE (nullptr, block);
system.nodes[0]->ledger.confirm (system.nodes[0]->store.tx_begin_write (), block->hash ());
nano::block_hash latest (system.nodes[0]->latest (nano::dev::genesis_key.pub));
nano::block_builder builder;
auto open = builder
Expand Down Expand Up @@ -123,6 +125,7 @@ TEST (bulk_pull, ascending_one_hash)
.build ();
node.work_generate_blocking (*block1);
ASSERT_EQ (nano::block_status::progress, node.process (block1));
node.ledger.confirm (node.store.tx_begin_write (), block1->hash ());
auto socket = std::make_shared<nano::transport::socket> (node, nano::transport::socket::endpoint_type_t::server);
auto connection = std::make_shared<nano::transport::tcp_server> (socket, system.nodes[0]);
auto req = std::make_unique<nano::bulk_pull> (nano::dev::network_params.network);
Expand Down Expand Up @@ -155,6 +158,7 @@ TEST (bulk_pull, ascending_two_account)
.build ();
node.work_generate_blocking (*block1);
ASSERT_EQ (nano::block_status::progress, node.process (block1));
node.ledger.confirm (node.store.tx_begin_write (), block1->hash ());
auto socket = std::make_shared<nano::transport::socket> (node, nano::transport::socket::endpoint_type_t::server);
auto connection = std::make_shared<nano::transport::tcp_server> (socket, system.nodes[0]);
auto req = std::make_unique<nano::bulk_pull> (nano::dev::network_params.network);
Expand Down Expand Up @@ -258,7 +262,7 @@ TEST (bulk_pull, count_limit)
.work (*system.work.generate (send1->hash ()))
.build ();
ASSERT_EQ (nano::block_status::progress, node0->process (receive1));

node0->ledger.confirm (node0->store.tx_begin_write (), receive1->hash ());
auto connection (std::make_shared<nano::transport::tcp_server> (std::make_shared<nano::transport::socket> (*node0, nano::transport::socket::endpoint_type_t::server), node0));
auto req = std::make_unique<nano::bulk_pull> (nano::dev::network_params.network);
req->start = receive1->hash ();
Expand Down
242 changes: 160 additions & 82 deletions nano/core_test/ledger.cpp

Large diffs are not rendered by default.

23 changes: 16 additions & 7 deletions nano/core_test/node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ TEST (node, send_single)
system.wallet (0)->insert_adhoc (nano::dev::genesis_key.prv);
system.wallet (1)->insert_adhoc (key2.prv);
ASSERT_NE (nullptr, system.wallet (0)->send_action (nano::dev::genesis_key.pub, key2.pub, system.nodes[0]->config.receive_minimum.number ()));
ASSERT_EQ (std::numeric_limits<nano::uint128_t>::max () - system.nodes[0]->config.receive_minimum.number (), system.nodes[0]->balance (nano::dev::genesis_key.pub));
ASSERT_TIMELY_EQ (5s, std::numeric_limits<nano::uint128_t>::max () - system.nodes[0]->config.receive_minimum.number (), system.nodes[0]->balance (nano::dev::genesis_key.pub));
ASSERT_TRUE (system.nodes[0]->balance (key2.pub).is_zero ());
ASSERT_TIMELY (10s, !system.nodes[0]->balance (key2.pub).is_zero ());
}
Expand All @@ -154,7 +154,7 @@ TEST (node, send_single_observing_peer)
system.wallet (0)->insert_adhoc (nano::dev::genesis_key.prv);
system.wallet (1)->insert_adhoc (key2.prv);
ASSERT_NE (nullptr, system.wallet (0)->send_action (nano::dev::genesis_key.pub, key2.pub, system.nodes[0]->config.receive_minimum.number ()));
ASSERT_EQ (std::numeric_limits<nano::uint128_t>::max () - system.nodes[0]->config.receive_minimum.number (), system.nodes[0]->balance (nano::dev::genesis_key.pub));
ASSERT_TIMELY_EQ (5s, std::numeric_limits<nano::uint128_t>::max () - system.nodes[0]->config.receive_minimum.number (), system.nodes[0]->balance (nano::dev::genesis_key.pub));
ASSERT_TRUE (system.nodes[0]->balance (key2.pub).is_zero ());
ASSERT_TIMELY (10s, std::all_of (system.nodes.begin (), system.nodes.end (), [&] (std::shared_ptr<nano::node> const & node_a) { return !node_a->balance (key2.pub).is_zero (); }));
}
Expand Down Expand Up @@ -189,6 +189,15 @@ TEST (node, send_out_of_order)
node1.process_active (send3);
node1.process_active (send2);
node1.process_active (send1);
ASSERT_TIMELY (5s, std::all_of (system.nodes.begin (), system.nodes.end (), [&] (std::shared_ptr<nano::node> const & node_a) {
auto blocks = { send1, send2, send3 };
return std::all_of (blocks.begin (), blocks.end (), [&] (std::shared_ptr<nano::block> block) {
return node_a->ledger.unconfirmed (block->hash ());
});
}));
node1.ledger.confirm (node1.store.tx_begin_write (), send3->hash ());
auto & node2 = *system.nodes[1];
node2.ledger.confirm (node2.store.tx_begin_write (), send3->hash ());
ASSERT_TIMELY (10s, std::all_of (system.nodes.begin (), system.nodes.end (), [&] (std::shared_ptr<nano::node> const & node_a) { return node_a->balance (nano::dev::genesis_key.pub) == nano::dev::constants.genesis_amount - node1.config.receive_minimum.number () * 3; }));
}

Expand Down Expand Up @@ -427,7 +436,7 @@ TEST (node, search_receivable_pruned)

// Confirmation
ASSERT_TIMELY (10s, node1->active.empty () && node2->active.empty ());
ASSERT_TIMELY (5s, node1->ledger.block_confirmed (node1->store.tx_begin_read (), send2->hash ()));
ASSERT_TIMELY (5s, node1->ledger.confirmed (node1->store.tx_begin_read (), send2->hash ()));
ASSERT_TIMELY_EQ (5s, node2->ledger.cache.cemented_count, 3);
system.wallet (0)->store.erase (node1->wallets.tx_begin_write (), nano::dev::genesis_key.pub);

Expand Down Expand Up @@ -1543,7 +1552,7 @@ TEST (node, bootstrap_confirm_frontiers)
// on 2 different systems at once and in sequence and there might be strange timing effects.
system0.deadline_set (10s);
system1.deadline_set (10s);
while (!node1->ledger.block_confirmed (node1->store.tx_begin_read (), send0->hash ()))
while (!node1->ledger.confirmed (node1->store.tx_begin_read (), send0->hash ()))
{
ASSERT_NO_ERROR (system0.poll (std::chrono::milliseconds (1)));
ASSERT_NO_ERROR (system1.poll (std::chrono::milliseconds (1)));
Expand Down Expand Up @@ -2233,7 +2242,7 @@ TEST (node, DISABLED_local_votes_cache_batch)
.build ();
ASSERT_EQ (nano::block_status::progress, node.ledger.process (node.store.tx_begin_write (), send1));
node.confirmation_height_processor.add (send1);
ASSERT_TIMELY (5s, node.ledger.block_confirmed (node.store.tx_begin_read (), send1->hash ()));
ASSERT_TIMELY (5s, node.ledger.confirmed (node.store.tx_begin_read (), send1->hash ()));
auto send2 = nano::state_block_builder ()
.account (nano::dev::genesis_key.pub)
.previous (send1->hash ())
Expand Down Expand Up @@ -3236,7 +3245,7 @@ TEST (node, bidirectional_tcp)
while (!confirmed)
{
auto transaction2 (node2->store.tx_begin_read ());
confirmed = node2->ledger.block_confirmed (transaction2, send1->hash ());
confirmed = node2->ledger.confirmed (transaction2, send1->hash ());
ASSERT_NO_ERROR (system.poll ());
}
// Test block propagation & confirmation from node 2 (remove representative from node 1)
Expand Down Expand Up @@ -3269,7 +3278,7 @@ TEST (node, bidirectional_tcp)
while (!confirmed)
{
auto transaction1 (node1->store.tx_begin_read ());
confirmed = node1->ledger.block_confirmed (transaction1, send2->hash ());
confirmed = node1->ledger.confirmed (transaction1, send2->hash ());
ASSERT_NO_ERROR (system.poll ());
}
}
Expand Down
8 changes: 4 additions & 4 deletions nano/core_test/request_aggregator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ TEST (request_aggregator, one_update)
.work (*node.work_generate_blocking (nano::dev::genesis->hash ()))
.build ();
ASSERT_EQ (nano::block_status::progress, node.ledger.process (node.store.tx_begin_write (), send1));
node.confirmation_height_processor.add (send1);
ASSERT_TIMELY (5s, node.ledger.block_confirmed (node.store.tx_begin_read (), send1->hash ()));
node.ledger.confirm (node.store.tx_begin_write (), send1->hash ());
ASSERT_TIMELY (5s, node.ledger.confirmed (node.store.tx_begin_read (), send1->hash ()));
auto send2 = nano::state_block_builder ()
.account (nano::dev::genesis_key.pub)
.previous (send1->hash ())
Expand Down Expand Up @@ -140,8 +140,8 @@ TEST (request_aggregator, two)
.work (*node.work_generate_blocking (nano::dev::genesis->hash ()))
.build ();
ASSERT_EQ (nano::block_status::progress, node.ledger.process (node.store.tx_begin_write (), send1));
node.confirmation_height_processor.add (send1);
ASSERT_TIMELY (5s, node.ledger.block_confirmed (node.store.tx_begin_read (), send1->hash ()));
node.ledger.confirm (node.store.tx_begin_write (), send1->hash ());
ASSERT_TIMELY (5s, node.ledger.confirmed (node.store.tx_begin_read (), send1->hash ()));
auto send2 = builder.make_block ()
.account (nano::dev::genesis_key.pub)
.previous (send1->hash ())
Expand Down
47 changes: 34 additions & 13 deletions nano/core_test/wallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,11 +177,11 @@ TEST (wallet, spend_all_one)
nano::block_hash latest1 (node1.latest (nano::dev::genesis_key.pub));
system.wallet (0)->insert_adhoc (nano::dev::genesis_key.prv);
nano::keypair key2;
ASSERT_NE (nullptr, system.wallet (0)->send_action (nano::dev::genesis_key.pub, key2.pub, std::numeric_limits<nano::uint128_t>::max ()));
auto transaction (node1.store.tx_begin_read ());
auto info2 = node1.ledger.account_info (transaction, nano::dev::genesis_key.pub);
auto block = system.wallet (0)->send_action (nano::dev::genesis_key.pub, key2.pub, std::numeric_limits<nano::uint128_t>::max ());
ASSERT_NE (nullptr, block);
node1.ledger.confirm (node1.store.tx_begin_write (), block->hash ());
auto info2 = node1.ledger.account_info (node1.store.tx_begin_read (), nano::dev::genesis_key.pub);
ASSERT_NE (latest1, info2->head);
auto block (node1.store.block.get (transaction, info2->head));
ASSERT_NE (nullptr, block);
ASSERT_EQ (latest1, block->previous ());
ASSERT_TRUE (info2->balance.is_zero ());
Expand Down Expand Up @@ -211,12 +211,13 @@ TEST (wallet, spend)
nano::keypair key2;
// Sending from empty accounts should always be an error. Accounts need to be opened with an open block, not a send block.
ASSERT_EQ (nullptr, system.wallet (0)->send_action (0, key2.pub, 0));
ASSERT_NE (nullptr, system.wallet (0)->send_action (nano::dev::genesis_key.pub, key2.pub, std::numeric_limits<nano::uint128_t>::max ()));
auto block = system.wallet (0)->send_action (nano::dev::genesis_key.pub, key2.pub, std::numeric_limits<nano::uint128_t>::max ());
ASSERT_NE (nullptr, block);
node1.ledger.confirm (node1.store.tx_begin_write (), block->hash ());
auto transaction (node1.store.tx_begin_read ());
auto info2 = node1.ledger.account_info (transaction, nano::dev::genesis_key.pub);
ASSERT_TRUE (info2);
ASSERT_NE (latest1, info2->head);
auto block (node1.store.block.get (transaction, info2->head));
ASSERT_NE (nullptr, block);
ASSERT_EQ (latest1, block->previous ());
ASSERT_TRUE (info2->balance.is_zero ());
Expand All @@ -228,7 +229,9 @@ TEST (wallet, partial_spend)
nano::test::system system (1);
system.wallet (0)->insert_adhoc (nano::dev::genesis_key.prv);
nano::keypair key2;
ASSERT_NE (nullptr, system.wallet (0)->send_action (nano::dev::genesis_key.pub, key2.pub, 500));
auto block = system.wallet (0)->send_action (nano::dev::genesis_key.pub, key2.pub, 500);
ASSERT_NE (nullptr, block);
system.nodes[0]->ledger.confirm (system.nodes[0]->store.tx_begin_write (), block->hash ());
ASSERT_EQ (std::numeric_limits<nano::uint128_t>::max () - 500, system.nodes[0]->balance (nano::dev::genesis_key.pub));
}

Expand All @@ -247,7 +250,9 @@ TEST (wallet, spend_no_previous)
}
}
nano::keypair key2;
ASSERT_NE (nullptr, system.wallet (0)->send_action (nano::dev::genesis_key.pub, key2.pub, 500));
auto block = system.wallet (0)->send_action (nano::dev::genesis_key.pub, key2.pub, 500);
ASSERT_NE (nullptr, block);
system.nodes[0]->ledger.confirm (system.nodes[0]->store.tx_begin_write (), block->hash ());
ASSERT_EQ (std::numeric_limits<nano::uint128_t>::max () - 500, system.nodes[0]->balance (nano::dev::genesis_key.pub));
}

Expand Down Expand Up @@ -646,6 +651,8 @@ TEST (wallet, work_generate)
}
nano::keypair key;
auto block (wallet->send_action (nano::dev::genesis_key.pub, key.pub, 100));
ASSERT_NE (nullptr, block);
node1.ledger.confirm (node1.store.tx_begin_write (), block->hash ());
auto transaction (node1.store.tx_begin_read ());
ASSERT_TIMELY (10s, node1.ledger.account_balance (transaction, nano::dev::genesis_key.pub) != amount1);
system.deadline_set (10s);
Expand Down Expand Up @@ -673,10 +680,10 @@ TEST (wallet, work_cache_delayed)
}
nano::keypair key;
auto block1 (wallet->send_action (nano::dev::genesis_key.pub, key.pub, 100));
ASSERT_EQ (block1->hash (), node1.latest (nano::dev::genesis_key.pub));
ASSERT_TIMELY_EQ (5s, block1->hash (), node1.latest (nano::dev::genesis_key.pub));
auto block2 (wallet->send_action (nano::dev::genesis_key.pub, key.pub, 100));
ASSERT_EQ (block2->hash (), node1.latest (nano::dev::genesis_key.pub));
ASSERT_EQ (block2->hash (), node1.wallets.delayed_work->operator[] (nano::dev::genesis_key.pub).as_block_hash ());
ASSERT_TIMELY_EQ (5s, block2->hash (), node1.latest (nano::dev::genesis_key.pub));
ASSERT_TIMELY_EQ (5s, block2->hash (), node1.wallets.delayed_work->operator[] (nano::dev::genesis_key.pub).as_block_hash ());
auto threshold (node1.default_difficulty (nano::work_version::work_1));
auto again (true);
system.deadline_set (10s);
Expand Down Expand Up @@ -817,7 +824,7 @@ TEST (wallet, send_race)
for (auto i (1); i < 60; ++i)
{
ASSERT_NE (nullptr, system.wallet (0)->send_action (nano::dev::genesis_key.pub, key2.pub, nano::Gxrb_ratio));
ASSERT_EQ (nano::dev::constants.genesis_amount - nano::Gxrb_ratio * i, system.nodes[0]->balance (nano::dev::genesis_key.pub));
ASSERT_TIMELY_EQ (5s, nano::dev::constants.genesis_amount - nano::Gxrb_ratio * i, system.nodes[0]->balance (nano::dev::genesis_key.pub));
}
}

Expand Down Expand Up @@ -933,6 +940,7 @@ TEST (wallet, change_seed)
wallet->insert_adhoc (nano::dev::genesis_key.prv, false);
auto block (wallet->send_action (nano::dev::genesis_key.pub, pub, 100));
ASSERT_NE (nullptr, block);
system.nodes[0]->ledger.confirm (system.nodes[0]->store.tx_begin_write (), block->hash ());
ASSERT_TIMELY (5s, nano::test::exists (*system.nodes[0], { block }));
{
auto transaction (wallet->wallets.tx_begin_write ());
Expand Down Expand Up @@ -967,6 +975,7 @@ TEST (wallet, deterministic_restore)
wallet->insert_adhoc (nano::dev::genesis_key.prv, false);
auto block (wallet->send_action (nano::dev::genesis_key.pub, pub, 100));
ASSERT_NE (nullptr, block);
system.nodes[0]->ledger.confirm (system.nodes[0]->store.tx_begin_write (), block->hash ());
ASSERT_TIMELY (5s, nano::test::exists (*system.nodes[0], { block }));
{
auto transaction (wallet->wallets.tx_begin_write ());
Expand Down Expand Up @@ -997,11 +1006,13 @@ TEST (wallet, epoch_2_validation)
{
auto send = wallet.send_action (nano::dev::genesis_key.pub, nano::dev::genesis_key.pub, amount, 1);
ASSERT_NE (nullptr, send);
ASSERT_TIMELY (5s, node.block_confirmed (send->hash ()));
ASSERT_EQ (nano::epoch::epoch_2, send->sideband ().details.epoch);
ASSERT_EQ (nano::epoch::epoch_0, send->sideband ().source_epoch); // Not used for send state blocks

auto receive = wallet.receive_action (send->hash (), nano::dev::genesis_key.pub, amount, send->link ().as_account (), 1);
ASSERT_NE (nullptr, receive);
ASSERT_TIMELY (5s, node.block_confirmed (receive->hash ()));
if (nano::dev::network_params.work.difficulty (*receive) < node.network_params.work.base)
{
ASSERT_GE (nano::dev::network_params.work.difficulty (*receive), node.network_params.work.epoch_2_receive);
Expand Down Expand Up @@ -1042,7 +1053,9 @@ TEST (wallet, epoch_2_receive_propagation)
auto amount = node.config.receive_minimum.number ();
auto send1 = wallet.send_action (nano::dev::genesis_key.pub, key.pub, amount, 1);
ASSERT_NE (nullptr, send1);
ASSERT_NE (nullptr, wallet.receive_action (send1->hash (), nano::dev::genesis_key.pub, amount, send1->link ().as_account (), 1));
ASSERT_TIMELY (5s, node.block_confirmed (send1->hash ()));
auto receive1 = wallet.receive_action (send1->hash (), nano::dev::genesis_key.pub, amount, send1->link ().as_account (), 1);
ASSERT_NE (nullptr, receive1);

// Upgrade the genesis account to epoch 2
auto epoch2 = system.upgrade_genesis_epoch (node, nano::epoch::epoch_2);
Expand All @@ -1051,6 +1064,7 @@ TEST (wallet, epoch_2_receive_propagation)
// Send a block
auto send2 = wallet.send_action (nano::dev::genesis_key.pub, key.pub, amount, 1);
ASSERT_NE (nullptr, send2);
ASSERT_TIMELY (5s, node.block_confirmed (send2->hash ()));

auto receive2 = wallet.receive_action (send2->hash (), key.pub, amount, send2->link ().as_account (), 1);
ASSERT_NE (nullptr, receive2);
Expand Down Expand Up @@ -1184,6 +1198,9 @@ TEST (wallet, search_receivable)
// Pending search should create the receive block
ASSERT_EQ (2, node.ledger.cache.block_count);
ASSERT_FALSE (wallet.search_receivable (wallet.wallets.tx_begin_read ()));
std::shared_ptr<nano::block> block;
ASSERT_TIMELY (5s, block = node.ledger.unconfirmed_next (node.store.tx_begin_read (), nano::dev::genesis->account ()));
node.ledger.confirm (node.store.tx_begin_write (), block->hash ());
ASSERT_TIMELY_EQ (3s, node.balance (nano::dev::genesis->account ()), nano::dev::constants.genesis_amount);
auto receive_hash = node.ledger.latest (node.store.tx_begin_read (), nano::dev::genesis->account ());
auto receive = node.block (receive_hash);
Expand Down Expand Up @@ -1213,7 +1230,11 @@ TEST (wallet, receive_pruned)
wallet1.insert_adhoc (nano::dev::genesis_key.prv, false);
auto amount = node2.config.receive_minimum.number ();
auto send1 = wallet1.send_action (nano::dev::genesis_key.pub, key.pub, amount, 1);
ASSERT_NE (nullptr, send1);
auto send2 = wallet1.send_action (nano::dev::genesis_key.pub, key.pub, 1, 1);
ASSERT_NE (nullptr, send2);
ASSERT_TIMELY (5s, node2.ledger.unconfirmed (send2->hash ()));
node2.ledger.confirm (node2.store.tx_begin_write (), send2->hash ());

// Pruning
ASSERT_TIMELY_EQ (5s, node2.ledger.cache.cemented_count, 3);
Expand Down
3 changes: 1 addition & 2 deletions nano/node/blockprocessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ void nano::block_processor::force (std::shared_ptr<nano::block> const & block_a)
void nano::block_processor::rollback_competitor (store::write_transaction const & transaction, nano::block const & block)
{
auto hash = block.hash ();
auto successor = node.ledger.successor (transaction, block.qualified_root ());
auto successor = node.ledger.unconfirmed_successor (block.qualified_root ());
if (successor != nullptr && successor->hash () != hash)
{
// Replace our block with the winner and roll back any dependent blocks
Expand Down Expand Up @@ -331,7 +331,6 @@ nano::block_status nano::block_processor::process_one (store::write_transaction
{
case nano::block_status::progress:
{
node.unconfirmed.block.emplace (hash, block);
queue_unchecked (transaction_a, hash);
/* For send blocks check epoch open unchecked (gap pending).
For state blocks check only send subtype and only if block epoch is not last epoch.
Expand Down
2 changes: 1 addition & 1 deletion nano/node/bootstrap_ascending/service.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ void nano::bootstrap_ascending::service::inspect (store::transaction const & tx,
{
case nano::block_status::progress:
{
const auto account = ledger.account (tx, hash);
const auto account = ledger.account (block);
const auto is_send = ledger.is_send (tx, block);

// If we've inserted any block in to an account, unmark it as blocked
Expand Down
Loading

0 comments on commit eac2780

Please sign in to comment.