Merge pull request #4458 from clemahieu/ledger_block_abstraction
Ledger block abstraction
This commit is contained in:
commit
f8ab9be833
24 changed files with 239 additions and 228 deletions
|
@ -1126,29 +1126,29 @@ TEST (mdb_block_store, sideband_height)
|
|||
.work (*pool.generate (key3.pub))
|
||||
.build ();
|
||||
ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, open));
|
||||
auto block1 (store.block.get (transaction, nano::dev::genesis->hash ()));
|
||||
auto block1 = ledger.block (transaction, nano::dev::genesis->hash ());
|
||||
ASSERT_EQ (block1->sideband ().height, 1);
|
||||
auto block2 (store.block.get (transaction, send->hash ()));
|
||||
auto block2 = ledger.block (transaction, send->hash ());
|
||||
ASSERT_EQ (block2->sideband ().height, 2);
|
||||
auto block3 (store.block.get (transaction, receive->hash ()));
|
||||
auto block3 = ledger.block (transaction, receive->hash ());
|
||||
ASSERT_EQ (block3->sideband ().height, 3);
|
||||
auto block4 (store.block.get (transaction, change->hash ()));
|
||||
auto block4 = ledger.block (transaction, change->hash ());
|
||||
ASSERT_EQ (block4->sideband ().height, 4);
|
||||
auto block5 (store.block.get (transaction, state_send1->hash ()));
|
||||
auto block5 = ledger.block (transaction, state_send1->hash ());
|
||||
ASSERT_EQ (block5->sideband ().height, 5);
|
||||
auto block6 (store.block.get (transaction, state_send2->hash ()));
|
||||
auto block6 = ledger.block (transaction, state_send2->hash ());
|
||||
ASSERT_EQ (block6->sideband ().height, 6);
|
||||
auto block7 (store.block.get (transaction, state_send3->hash ()));
|
||||
auto block7 = ledger.block (transaction, state_send3->hash ());
|
||||
ASSERT_EQ (block7->sideband ().height, 7);
|
||||
auto block8 (store.block.get (transaction, state_open->hash ()));
|
||||
auto block8 = ledger.block (transaction, state_open->hash ());
|
||||
ASSERT_EQ (block8->sideband ().height, 1);
|
||||
auto block9 (store.block.get (transaction, epoch->hash ()));
|
||||
auto block9 = ledger.block (transaction, epoch->hash ());
|
||||
ASSERT_EQ (block9->sideband ().height, 2);
|
||||
auto block10 (store.block.get (transaction, epoch_open->hash ()));
|
||||
auto block10 = ledger.block (transaction, epoch_open->hash ());
|
||||
ASSERT_EQ (block10->sideband ().height, 1);
|
||||
auto block11 (store.block.get (transaction, state_receive->hash ()));
|
||||
auto block11 = ledger.block (transaction, state_receive->hash ());
|
||||
ASSERT_EQ (block11->sideband ().height, 2);
|
||||
auto block12 (store.block.get (transaction, open->hash ()));
|
||||
auto block12 = ledger.block (transaction, open->hash ());
|
||||
ASSERT_EQ (block12->sideband ().height, 1);
|
||||
}
|
||||
|
||||
|
|
|
@ -659,13 +659,13 @@ TEST (bootstrap_processor, push_diamond_pruning)
|
|||
auto transaction (node1->store.tx_begin_write ());
|
||||
ASSERT_EQ (1, node1->ledger.pruning_action (transaction, send1->hash (), 2));
|
||||
ASSERT_EQ (1, node1->ledger.pruning_action (transaction, open->hash (), 1));
|
||||
ASSERT_TRUE (node1->store.block.exists (transaction, nano::dev::genesis->hash ()));
|
||||
ASSERT_FALSE (node1->store.block.exists (transaction, send1->hash ()));
|
||||
ASSERT_TRUE (node1->ledger.block_exists (transaction, nano::dev::genesis->hash ()));
|
||||
ASSERT_FALSE (node1->ledger.block_exists (transaction, send1->hash ()));
|
||||
ASSERT_TRUE (node1->store.pruned.exists (transaction, send1->hash ()));
|
||||
ASSERT_FALSE (node1->store.block.exists (transaction, open->hash ()));
|
||||
ASSERT_FALSE (node1->ledger.block_exists (transaction, open->hash ()));
|
||||
ASSERT_TRUE (node1->store.pruned.exists (transaction, open->hash ()));
|
||||
ASSERT_TRUE (node1->store.block.exists (transaction, send2->hash ()));
|
||||
ASSERT_TRUE (node1->store.block.exists (transaction, receive->hash ()));
|
||||
ASSERT_TRUE (node1->ledger.block_exists (transaction, send2->hash ()));
|
||||
ASSERT_TRUE (node1->ledger.block_exists (transaction, receive->hash ()));
|
||||
ASSERT_EQ (2, node1->ledger.cache.pruned_count);
|
||||
ASSERT_EQ (5, node1->ledger.cache.block_count);
|
||||
}
|
||||
|
|
|
@ -78,7 +78,7 @@ TEST (ledger, process_modifies_sideband)
|
|||
.work (*pool.generate (nano::dev::genesis->hash ()))
|
||||
.build ();
|
||||
ASSERT_EQ (nano::block_status::progress, ledger.process (store.tx_begin_write (), send1));
|
||||
ASSERT_EQ (send1->sideband ().timestamp, store.block.get (store.tx_begin_read (), send1->hash ())->sideband ().timestamp);
|
||||
ASSERT_EQ (send1->sideband ().timestamp, ledger.block (store.tx_begin_read (), send1->hash ())->sideband ().timestamp);
|
||||
}
|
||||
|
||||
// Create a send block and publish it.
|
||||
|
@ -118,7 +118,7 @@ TEST (ledger, process_send)
|
|||
auto info2 = ledger.account_info (transaction, nano::dev::genesis_key.pub);
|
||||
ASSERT_TRUE (info2);
|
||||
ASSERT_EQ (2, info2->block_count);
|
||||
auto latest6 = store.block.get (transaction, info2->head);
|
||||
auto latest6 = ledger.block (transaction, info2->head);
|
||||
ASSERT_NE (nullptr, latest6);
|
||||
auto latest7 = dynamic_cast<nano::send_block *> (latest6.get ());
|
||||
ASSERT_NE (nullptr, latest7);
|
||||
|
@ -150,14 +150,14 @@ TEST (ledger, process_send)
|
|||
ASSERT_EQ (nano::dev::constants.genesis_amount - 50, ledger.weight (key2.pub));
|
||||
auto info3 = ledger.account_info (transaction, nano::dev::genesis_key.pub);
|
||||
ASSERT_TRUE (info3);
|
||||
auto latest2 = store.block.get (transaction, info3->head);
|
||||
auto latest2 = ledger.block (transaction, info3->head);
|
||||
ASSERT_NE (nullptr, latest2);
|
||||
auto latest3 = dynamic_cast<nano::send_block *> (latest2.get ());
|
||||
ASSERT_NE (nullptr, latest3);
|
||||
ASSERT_EQ (*send, *latest3);
|
||||
auto info4 = ledger.account_info (transaction, key2.pub);
|
||||
ASSERT_TRUE (info4);
|
||||
auto latest4 = store.block.get (transaction, info4->head);
|
||||
auto latest4 = ledger.block (transaction, info4->head);
|
||||
ASSERT_NE (nullptr, latest4);
|
||||
auto latest5 = dynamic_cast<nano::open_block *> (latest4.get ());
|
||||
ASSERT_NE (nullptr, latest5);
|
||||
|
@ -2382,8 +2382,8 @@ TEST (ledger, state_send_receive)
|
|||
.work (*pool.generate (nano::dev::genesis->hash ()))
|
||||
.build ();
|
||||
ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, send1));
|
||||
ASSERT_TRUE (store.block.exists (transaction, send1->hash ()));
|
||||
auto send2 = store.block.get (transaction, send1->hash ());
|
||||
ASSERT_TRUE (ledger.block_exists (transaction, send1->hash ()));
|
||||
auto send2 = ledger.block (transaction, send1->hash ());
|
||||
ASSERT_NE (nullptr, send2);
|
||||
ASSERT_EQ (*send1, *send2);
|
||||
ASSERT_EQ (nano::dev::constants.genesis_amount - nano::Gxrb_ratio, ledger.balance (transaction, send1->hash ()));
|
||||
|
@ -2405,8 +2405,8 @@ TEST (ledger, state_send_receive)
|
|||
.work (*pool.generate (send1->hash ()))
|
||||
.build ();
|
||||
ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, receive1));
|
||||
ASSERT_TRUE (store.block.exists (transaction, receive1->hash ()));
|
||||
auto receive2 = store.block.get (transaction, receive1->hash ());
|
||||
ASSERT_TRUE (ledger.block_exists (transaction, receive1->hash ()));
|
||||
auto receive2 = ledger.block (transaction, receive1->hash ());
|
||||
ASSERT_NE (nullptr, receive2);
|
||||
ASSERT_EQ (*receive1, *receive2);
|
||||
ASSERT_EQ (nano::dev::constants.genesis_amount, ledger.balance (transaction, receive1->hash ()));
|
||||
|
@ -2437,8 +2437,8 @@ TEST (ledger, state_receive)
|
|||
.work (*pool.generate (nano::dev::genesis->hash ()))
|
||||
.build ();
|
||||
ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, send1));
|
||||
ASSERT_TRUE (store.block.exists (transaction, send1->hash ()));
|
||||
auto send2 = store.block.get (transaction, send1->hash ());
|
||||
ASSERT_TRUE (ledger.block_exists (transaction, send1->hash ()));
|
||||
auto send2 = ledger.block (transaction, send1->hash ());
|
||||
ASSERT_NE (nullptr, send2);
|
||||
ASSERT_EQ (*send1, *send2);
|
||||
ASSERT_EQ (nano::dev::constants.genesis_amount - nano::Gxrb_ratio, ledger.balance (transaction, send1->hash ()));
|
||||
|
@ -2455,8 +2455,8 @@ TEST (ledger, state_receive)
|
|||
.work (*pool.generate (send1->hash ()))
|
||||
.build ();
|
||||
ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, receive1));
|
||||
ASSERT_TRUE (store.block.exists (transaction, receive1->hash ()));
|
||||
auto receive2 = store.block.get (transaction, receive1->hash ());
|
||||
ASSERT_TRUE (ledger.block_exists (transaction, receive1->hash ()));
|
||||
auto receive2 = ledger.block (transaction, receive1->hash ());
|
||||
ASSERT_NE (nullptr, receive2);
|
||||
ASSERT_EQ (*receive1, *receive2);
|
||||
ASSERT_EQ (nano::dev::constants.genesis_amount, ledger.balance (transaction, receive1->hash ()));
|
||||
|
@ -2488,8 +2488,8 @@ TEST (ledger, state_rep_change)
|
|||
.work (*pool.generate (nano::dev::genesis->hash ()))
|
||||
.build ();
|
||||
ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, change1));
|
||||
ASSERT_TRUE (store.block.exists (transaction, change1->hash ()));
|
||||
auto change2 = store.block.get (transaction, change1->hash ());
|
||||
ASSERT_TRUE (ledger.block_exists (transaction, change1->hash ()));
|
||||
auto change2 = ledger.block (transaction, change1->hash ());
|
||||
ASSERT_NE (nullptr, change2);
|
||||
ASSERT_EQ (*change1, *change2);
|
||||
ASSERT_EQ (nano::dev::constants.genesis_amount, ledger.balance (transaction, change1->hash ()));
|
||||
|
@ -2522,8 +2522,8 @@ TEST (ledger, state_open)
|
|||
.work (*pool.generate (nano::dev::genesis->hash ()))
|
||||
.build ();
|
||||
ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, send1));
|
||||
ASSERT_TRUE (store.block.exists (transaction, send1->hash ()));
|
||||
auto send2 = store.block.get (transaction, send1->hash ());
|
||||
ASSERT_TRUE (ledger.block_exists (transaction, send1->hash ()));
|
||||
auto send2 = ledger.block (transaction, send1->hash ());
|
||||
ASSERT_NE (nullptr, send2);
|
||||
ASSERT_EQ (*send1, *send2);
|
||||
ASSERT_EQ (nano::dev::constants.genesis_amount - nano::Gxrb_ratio, ledger.balance (transaction, send1->hash ()));
|
||||
|
@ -2542,8 +2542,8 @@ TEST (ledger, state_open)
|
|||
.build ();
|
||||
ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, open1));
|
||||
ASSERT_FALSE (store.pending.exists (transaction, nano::pending_key (destination.pub, send1->hash ())));
|
||||
ASSERT_TRUE (store.block.exists (transaction, open1->hash ()));
|
||||
auto open2 = store.block.get (transaction, open1->hash ());
|
||||
ASSERT_TRUE (ledger.block_exists (transaction, open1->hash ()));
|
||||
auto open2 = ledger.block (transaction, open1->hash ());
|
||||
ASSERT_NE (nullptr, open2);
|
||||
ASSERT_EQ (*open1, *open2);
|
||||
ASSERT_EQ (nano::Gxrb_ratio, ledger.balance (transaction, open1->hash ()));
|
||||
|
@ -2665,8 +2665,8 @@ TEST (ledger, state_unreceivable_fail)
|
|||
.work (*pool.generate (nano::dev::genesis->hash ()))
|
||||
.build ();
|
||||
ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, send1));
|
||||
ASSERT_TRUE (store.block.exists (transaction, send1->hash ()));
|
||||
auto send2 = store.block.get (transaction, send1->hash ());
|
||||
ASSERT_TRUE (ledger.block_exists (transaction, send1->hash ()));
|
||||
auto send2 = ledger.block (transaction, send1->hash ());
|
||||
ASSERT_NE (nullptr, send2);
|
||||
ASSERT_EQ (*send1, *send2);
|
||||
ASSERT_EQ (nano::dev::constants.genesis_amount - nano::Gxrb_ratio, ledger.balance (transaction, send1->hash ()));
|
||||
|
@ -2702,8 +2702,8 @@ TEST (ledger, state_receive_bad_amount_fail)
|
|||
.work (*pool.generate (nano::dev::genesis->hash ()))
|
||||
.build ();
|
||||
ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, send1));
|
||||
ASSERT_TRUE (store.block.exists (transaction, send1->hash ()));
|
||||
auto send2 = store.block.get (transaction, send1->hash ());
|
||||
ASSERT_TRUE (ledger.block_exists (transaction, send1->hash ()));
|
||||
auto send2 = ledger.block (transaction, send1->hash ());
|
||||
ASSERT_NE (nullptr, send2);
|
||||
ASSERT_EQ (*send1, *send2);
|
||||
ASSERT_EQ (nano::dev::constants.genesis_amount - nano::Gxrb_ratio, ledger.balance (transaction, send1->hash ()));
|
||||
|
@ -2774,8 +2774,8 @@ TEST (ledger, state_receive_wrong_account_fail)
|
|||
.work (*pool.generate (nano::dev::genesis->hash ()))
|
||||
.build ();
|
||||
ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, send1));
|
||||
ASSERT_TRUE (store.block.exists (transaction, send1->hash ()));
|
||||
auto send2 = store.block.get (transaction, send1->hash ());
|
||||
ASSERT_TRUE (ledger.block_exists (transaction, send1->hash ()));
|
||||
auto send2 = ledger.block (transaction, send1->hash ());
|
||||
ASSERT_NE (nullptr, send2);
|
||||
ASSERT_EQ (*send1, *send2);
|
||||
ASSERT_EQ (nano::dev::constants.genesis_amount - nano::Gxrb_ratio, ledger.balance (transaction, send1->hash ()));
|
||||
|
@ -2968,8 +2968,8 @@ TEST (ledger, state_send_change)
|
|||
.work (*pool.generate (nano::dev::genesis->hash ()))
|
||||
.build ();
|
||||
ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, send1));
|
||||
ASSERT_TRUE (store.block.exists (transaction, send1->hash ()));
|
||||
auto send2 = store.block.get (transaction, send1->hash ());
|
||||
ASSERT_TRUE (ledger.block_exists (transaction, send1->hash ()));
|
||||
auto send2 = ledger.block (transaction, send1->hash ());
|
||||
ASSERT_NE (nullptr, send2);
|
||||
ASSERT_EQ (*send1, *send2);
|
||||
ASSERT_EQ (nano::dev::constants.genesis_amount - nano::Gxrb_ratio, ledger.balance (transaction, send1->hash ()));
|
||||
|
@ -3001,8 +3001,8 @@ TEST (ledger, state_receive_change)
|
|||
.work (*pool.generate (nano::dev::genesis->hash ()))
|
||||
.build ();
|
||||
ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, send1));
|
||||
ASSERT_TRUE (store.block.exists (transaction, send1->hash ()));
|
||||
auto send2 = store.block.get (transaction, send1->hash ());
|
||||
ASSERT_TRUE (ledger.block_exists (transaction, send1->hash ()));
|
||||
auto send2 = ledger.block (transaction, send1->hash ());
|
||||
ASSERT_NE (nullptr, send2);
|
||||
ASSERT_EQ (*send1, *send2);
|
||||
ASSERT_EQ (nano::dev::constants.genesis_amount - nano::Gxrb_ratio, ledger.balance (transaction, send1->hash ()));
|
||||
|
@ -3020,8 +3020,8 @@ TEST (ledger, state_receive_change)
|
|||
.work (*pool.generate (send1->hash ()))
|
||||
.build ();
|
||||
ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, receive1));
|
||||
ASSERT_TRUE (store.block.exists (transaction, receive1->hash ()));
|
||||
auto receive2 = store.block.get (transaction, receive1->hash ());
|
||||
ASSERT_TRUE (ledger.block_exists (transaction, receive1->hash ()));
|
||||
auto receive2 = ledger.block (transaction, receive1->hash ());
|
||||
ASSERT_NE (nullptr, receive2);
|
||||
ASSERT_EQ (*receive1, *receive2);
|
||||
ASSERT_EQ (nano::dev::constants.genesis_amount, ledger.balance (transaction, receive1->hash ()));
|
||||
|
@ -3140,8 +3140,8 @@ TEST (ledger, state_rollback_send)
|
|||
.work (*pool.generate (nano::dev::genesis->hash ()))
|
||||
.build ();
|
||||
ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, send1));
|
||||
ASSERT_TRUE (store.block.exists (transaction, send1->hash ()));
|
||||
auto send2 = store.block.get (transaction, send1->hash ());
|
||||
ASSERT_TRUE (ledger.block_exists (transaction, send1->hash ()));
|
||||
auto send2 = ledger.block (transaction, send1->hash ());
|
||||
ASSERT_NE (nullptr, send2);
|
||||
ASSERT_EQ (*send1, *send2);
|
||||
ASSERT_EQ (nano::dev::constants.genesis_amount - nano::Gxrb_ratio, ledger.account_balance (transaction, nano::dev::genesis->account ()));
|
||||
|
@ -3151,7 +3151,7 @@ TEST (ledger, state_rollback_send)
|
|||
ASSERT_EQ (nano::dev::genesis->account (), info->source);
|
||||
ASSERT_EQ (nano::Gxrb_ratio, info->amount.number ());
|
||||
ASSERT_FALSE (ledger.rollback (transaction, send1->hash ()));
|
||||
ASSERT_FALSE (store.block.exists (transaction, send1->hash ()));
|
||||
ASSERT_FALSE (ledger.block_exists (transaction, send1->hash ()));
|
||||
ASSERT_EQ (nano::dev::constants.genesis_amount, ledger.account_balance (transaction, nano::dev::genesis->account ()));
|
||||
ASSERT_EQ (nano::dev::constants.genesis_amount, ledger.weight (nano::dev::genesis->account ()));
|
||||
ASSERT_FALSE (store.pending.exists (transaction, nano::pending_key (nano::dev::genesis->account (), send1->hash ())));
|
||||
|
@ -3195,7 +3195,7 @@ TEST (ledger, state_rollback_receive)
|
|||
ASSERT_TRUE (info);
|
||||
ASSERT_EQ (nano::dev::genesis->account (), info->source);
|
||||
ASSERT_EQ (nano::Gxrb_ratio, info->amount.number ());
|
||||
ASSERT_FALSE (store.block.exists (transaction, receive1->hash ()));
|
||||
ASSERT_FALSE (ledger.block_exists (transaction, receive1->hash ()));
|
||||
ASSERT_EQ (nano::dev::constants.genesis_amount - nano::Gxrb_ratio, ledger.account_balance (transaction, nano::dev::genesis->account ()));
|
||||
ASSERT_EQ (nano::dev::constants.genesis_amount - nano::Gxrb_ratio, ledger.weight (nano::dev::genesis->account ()));
|
||||
ASSERT_EQ (store.account.count (transaction), ledger.cache.account_count);
|
||||
|
@ -3235,8 +3235,8 @@ TEST (ledger, state_rollback_received_send)
|
|||
ASSERT_FALSE (store.pending.exists (transaction, nano::pending_key (nano::dev::genesis->account (), receive1->hash ())));
|
||||
ASSERT_FALSE (ledger.rollback (transaction, send1->hash ()));
|
||||
ASSERT_FALSE (store.pending.exists (transaction, nano::pending_key (nano::dev::genesis->account (), send1->hash ())));
|
||||
ASSERT_FALSE (store.block.exists (transaction, send1->hash ()));
|
||||
ASSERT_FALSE (store.block.exists (transaction, receive1->hash ()));
|
||||
ASSERT_FALSE (ledger.block_exists (transaction, send1->hash ()));
|
||||
ASSERT_FALSE (ledger.block_exists (transaction, receive1->hash ()));
|
||||
ASSERT_EQ (nano::dev::constants.genesis_amount, ledger.account_balance (transaction, nano::dev::genesis->account ()));
|
||||
ASSERT_EQ (nano::dev::constants.genesis_amount, ledger.weight (nano::dev::genesis->account ()));
|
||||
ASSERT_EQ (0, ledger.account_balance (transaction, key.pub));
|
||||
|
@ -3265,7 +3265,7 @@ TEST (ledger, state_rep_change_rollback)
|
|||
.build ();
|
||||
ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, change1));
|
||||
ASSERT_FALSE (ledger.rollback (transaction, change1->hash ()));
|
||||
ASSERT_FALSE (store.block.exists (transaction, change1->hash ()));
|
||||
ASSERT_FALSE (ledger.block_exists (transaction, change1->hash ()));
|
||||
ASSERT_EQ (nano::dev::constants.genesis_amount, ledger.account_balance (transaction, nano::dev::genesis->account ()));
|
||||
ASSERT_EQ (nano::dev::constants.genesis_amount, ledger.weight (nano::dev::genesis->account ()));
|
||||
ASSERT_EQ (0, ledger.weight (rep.pub));
|
||||
|
@ -3303,7 +3303,7 @@ TEST (ledger, state_open_rollback)
|
|||
.build ();
|
||||
ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, open1));
|
||||
ASSERT_FALSE (ledger.rollback (transaction, open1->hash ()));
|
||||
ASSERT_FALSE (store.block.exists (transaction, open1->hash ()));
|
||||
ASSERT_FALSE (ledger.block_exists (transaction, open1->hash ()));
|
||||
ASSERT_EQ (0, ledger.account_balance (transaction, destination.pub));
|
||||
ASSERT_EQ (nano::dev::constants.genesis_amount - nano::Gxrb_ratio, ledger.weight (nano::dev::genesis->account ()));
|
||||
auto info = ledger.pending_info (transaction, nano::pending_key (destination.pub, send1->hash ()));
|
||||
|
@ -3334,7 +3334,7 @@ TEST (ledger, state_send_change_rollback)
|
|||
.build ();
|
||||
ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, send1));
|
||||
ASSERT_FALSE (ledger.rollback (transaction, send1->hash ()));
|
||||
ASSERT_FALSE (store.block.exists (transaction, send1->hash ()));
|
||||
ASSERT_FALSE (ledger.block_exists (transaction, send1->hash ()));
|
||||
ASSERT_EQ (nano::dev::constants.genesis_amount, ledger.account_balance (transaction, nano::dev::genesis->account ()));
|
||||
ASSERT_EQ (nano::dev::constants.genesis_amount, ledger.weight (nano::dev::genesis->account ()));
|
||||
ASSERT_EQ (0, ledger.weight (rep.pub));
|
||||
|
@ -3373,7 +3373,7 @@ TEST (ledger, state_receive_change_rollback)
|
|||
.build ();
|
||||
ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, receive1));
|
||||
ASSERT_FALSE (ledger.rollback (transaction, receive1->hash ()));
|
||||
ASSERT_FALSE (store.block.exists (transaction, receive1->hash ()));
|
||||
ASSERT_FALSE (ledger.block_exists (transaction, receive1->hash ()));
|
||||
ASSERT_EQ (nano::dev::constants.genesis_amount - nano::Gxrb_ratio, ledger.account_balance (transaction, nano::dev::genesis->account ()));
|
||||
ASSERT_EQ (nano::dev::constants.genesis_amount - nano::Gxrb_ratio, ledger.weight (nano::dev::genesis->account ()));
|
||||
ASSERT_EQ (0, ledger.weight (rep.pub));
|
||||
|
@ -4206,7 +4206,7 @@ TEST (ledger, unchecked_epoch)
|
|||
}
|
||||
node1.block_processor.add (send1);
|
||||
node1.block_processor.add (open1);
|
||||
ASSERT_TIMELY (5s, node1.store.block.exists (node1.store.tx_begin_read (), epoch1->hash ()));
|
||||
ASSERT_TIMELY (5s, node1.ledger.block_exists (node1.store.tx_begin_read (), epoch1->hash ()));
|
||||
{
|
||||
// Waits for the last blocks to pass through block_processor and unchecked.put queues
|
||||
ASSERT_TIMELY_EQ (10s, 0, node1.unchecked.count ());
|
||||
|
@ -4281,17 +4281,17 @@ TEST (ledger, unchecked_epoch_invalid)
|
|||
node1.block_processor.add (send1);
|
||||
node1.block_processor.add (open1);
|
||||
// Waits for the last blocks to pass through block_processor and unchecked.put queues
|
||||
ASSERT_TIMELY (10s, node1.store.block.exists (node1.store.tx_begin_read (), epoch2->hash ()));
|
||||
ASSERT_TIMELY (10s, node1.ledger.block_exists (node1.store.tx_begin_read (), epoch2->hash ()));
|
||||
{
|
||||
auto transaction = node1.store.tx_begin_read ();
|
||||
ASSERT_FALSE (node1.store.block.exists (transaction, epoch1->hash ()));
|
||||
ASSERT_FALSE (node1.ledger.block_exists (transaction, epoch1->hash ()));
|
||||
auto unchecked_count = node1.unchecked.count ();
|
||||
ASSERT_EQ (unchecked_count, 0);
|
||||
ASSERT_EQ (unchecked_count, node1.unchecked.count ());
|
||||
auto info = node1.ledger.account_info (transaction, destination.pub);
|
||||
ASSERT_TRUE (info);
|
||||
ASSERT_NE (info->epoch (), nano::epoch::epoch_1);
|
||||
auto epoch2_store = node1.store.block.get (transaction, epoch2->hash ());
|
||||
auto epoch2_store = node1.ledger.block (transaction, epoch2->hash ());
|
||||
ASSERT_NE (nullptr, epoch2_store);
|
||||
ASSERT_EQ (nano::epoch::epoch_0, epoch2_store->sideband ().details.epoch);
|
||||
ASSERT_TRUE (epoch2_store->sideband ().details.is_send);
|
||||
|
@ -4348,7 +4348,7 @@ TEST (ledger, unchecked_open)
|
|||
}
|
||||
node1.block_processor.add (send1);
|
||||
// Waits for the send1 block to pass through block_processor and unchecked.put queues
|
||||
ASSERT_TIMELY (5s, node1.store.block.exists (node1.store.tx_begin_read (), open1->hash ()));
|
||||
ASSERT_TIMELY (5s, node1.ledger.block_exists (node1.store.tx_begin_read (), open1->hash ()));
|
||||
ASSERT_EQ (0, node1.unchecked.count ());
|
||||
}
|
||||
|
||||
|
@ -4419,7 +4419,7 @@ TEST (ledger, unchecked_receive)
|
|||
ASSERT_EQ (blocks.size (), 1);
|
||||
}
|
||||
node1.block_processor.add (send2);
|
||||
ASSERT_TIMELY (10s, node1.store.block.exists (node1.store.tx_begin_read (), receive1->hash ()));
|
||||
ASSERT_TIMELY (10s, node1.ledger.block_exists (node1.store.tx_begin_read (), receive1->hash ()));
|
||||
ASSERT_EQ (0, node1.unchecked.count ());
|
||||
}
|
||||
|
||||
|
|
|
@ -668,8 +668,8 @@ TEST (node, fork_keep)
|
|||
auto winner (*election1->tally ().begin ());
|
||||
ASSERT_EQ (*send1, *winner.second);
|
||||
ASSERT_EQ (nano::dev::constants.genesis_amount - 100, winner.first);
|
||||
ASSERT_TRUE (node1.store.block.exists (transaction0, send1->hash ()));
|
||||
ASSERT_TRUE (node2.store.block.exists (transaction1, send1->hash ()));
|
||||
ASSERT_TRUE (node1.ledger.block_exists (transaction0, send1->hash ()));
|
||||
ASSERT_TRUE (node2.ledger.block_exists (transaction1, send1->hash ()));
|
||||
}
|
||||
|
||||
TEST (node, fork_flip)
|
||||
|
@ -811,7 +811,7 @@ TEST (node, fork_bootstrap_flip)
|
|||
// Insert but don't rebroadcast, simulating settled blocks
|
||||
ASSERT_EQ (nano::block_status::progress, node1.ledger.process (node1.store.tx_begin_write (), send1));
|
||||
ASSERT_EQ (nano::block_status::progress, node2.ledger.process (node2.store.tx_begin_write (), send2));
|
||||
ASSERT_TRUE (node2.store.block.exists (node2.store.tx_begin_read (), send2->hash ()));
|
||||
ASSERT_TRUE (node2.ledger.block_exists (node2.store.tx_begin_read (), send2->hash ()));
|
||||
node2.bootstrap_initiator.bootstrap (node1.network.endpoint ()); // Additionally add new peer to confirm & replace bootstrap block
|
||||
auto again (true);
|
||||
system0.deadline_set (50s);
|
||||
|
@ -820,7 +820,7 @@ TEST (node, fork_bootstrap_flip)
|
|||
{
|
||||
ASSERT_NO_ERROR (system0.poll ());
|
||||
ASSERT_NO_ERROR (system1.poll ());
|
||||
again = !node2.store.block.exists (node2.store.tx_begin_read (), send1->hash ());
|
||||
again = !node2.ledger.block_exists (node2.store.tx_begin_read (), send1->hash ());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -972,9 +972,9 @@ TEST (node, fork_open_flip)
|
|||
// check the correct blocks are in the ledgers
|
||||
auto transaction1 (node1.store.tx_begin_read ());
|
||||
auto transaction2 (node2.store.tx_begin_read ());
|
||||
ASSERT_TRUE (node1.store.block.exists (transaction1, open1->hash ()));
|
||||
ASSERT_TRUE (node2.store.block.exists (transaction2, open1->hash ()));
|
||||
ASSERT_FALSE (node2.store.block.exists (transaction2, open2->hash ()));
|
||||
ASSERT_TRUE (node1.ledger.block_exists (transaction1, open1->hash ()));
|
||||
ASSERT_TRUE (node2.ledger.block_exists (transaction2, open1->hash ()));
|
||||
ASSERT_FALSE (node2.ledger.block_exists (transaction2, open2->hash ()));
|
||||
}
|
||||
|
||||
TEST (node, coherent_observer)
|
||||
|
@ -983,7 +983,7 @@ TEST (node, coherent_observer)
|
|||
auto & node1 (*system.nodes[0]);
|
||||
node1.observers.blocks.add ([&node1] (nano::election_status const & status_a, std::vector<nano::vote_with_weight_info> const &, nano::account const &, nano::uint128_t const &, bool, bool) {
|
||||
auto transaction (node1.store.tx_begin_read ());
|
||||
ASSERT_TRUE (node1.store.block.exists (transaction, status_a.winner->hash ()));
|
||||
ASSERT_TRUE (node1.ledger.block_exists (transaction, status_a.winner->hash ()));
|
||||
});
|
||||
system.wallet (0)->insert_adhoc (nano::dev::genesis_key.prv);
|
||||
nano::keypair key;
|
||||
|
|
|
@ -181,7 +181,7 @@ TEST (wallet, spend_all_one)
|
|||
auto transaction (node1.store.tx_begin_read ());
|
||||
auto info2 = node1.ledger.account_info (transaction, nano::dev::genesis_key.pub);
|
||||
ASSERT_NE (latest1, info2->head);
|
||||
auto block (node1.store.block.get (transaction, info2->head));
|
||||
auto block = node1.ledger.block (transaction, info2->head);
|
||||
ASSERT_NE (nullptr, block);
|
||||
ASSERT_EQ (latest1, block->previous ());
|
||||
ASSERT_TRUE (info2->balance.is_zero ());
|
||||
|
@ -216,7 +216,7 @@ TEST (wallet, spend)
|
|||
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));
|
||||
auto block = node1.ledger.block (transaction, info2->head);
|
||||
ASSERT_NE (nullptr, block);
|
||||
ASSERT_EQ (latest1, block->previous ());
|
||||
ASSERT_TRUE (info2->balance.is_zero ());
|
||||
|
@ -1223,7 +1223,7 @@ TEST (wallet, receive_pruned)
|
|||
}
|
||||
ASSERT_EQ (1, node2.ledger.cache.pruned_count);
|
||||
ASSERT_TRUE (node2.ledger.block_or_pruned_exists (send1->hash ()));
|
||||
ASSERT_FALSE (node2.store.block.exists (node2.store.tx_begin_read (), send1->hash ()));
|
||||
ASSERT_FALSE (node2.ledger.block_exists (node2.store.tx_begin_read (), send1->hash ()));
|
||||
|
||||
wallet2.insert_adhoc (key.prv, false);
|
||||
|
||||
|
|
|
@ -1411,17 +1411,17 @@ int main (int argc, char * const * argv)
|
|||
|
||||
auto hash (info.open_block);
|
||||
nano::block_hash calculated_hash (0);
|
||||
auto block (node->store.block.get (transaction, hash)); // Block data
|
||||
auto block = node->ledger.block (transaction, hash); // Block data
|
||||
uint64_t height (0);
|
||||
if (node->ledger.pruning && confirmation_height_info.height != 0)
|
||||
{
|
||||
hash = confirmation_height_info.frontier;
|
||||
block = node->store.block.get (transaction, hash);
|
||||
block = node->ledger.block (transaction, hash);
|
||||
// Iteration until pruned block
|
||||
bool pruned_block (false);
|
||||
while (!pruned_block && !block->previous ().is_zero ())
|
||||
{
|
||||
auto previous_block (node->store.block.get (transaction, block->previous ()));
|
||||
auto previous_block = node->ledger.block (transaction, block->previous ());
|
||||
if (previous_block != nullptr)
|
||||
{
|
||||
hash = previous_block->hash ();
|
||||
|
@ -1591,7 +1591,7 @@ int main (int argc, char * const * argv)
|
|||
// Retrieving block data
|
||||
if (!hash.is_zero ())
|
||||
{
|
||||
block = node->store.block.get (transaction, hash);
|
||||
block = node->ledger.block (transaction, hash);
|
||||
}
|
||||
}
|
||||
// Check if required block exists
|
||||
|
@ -1676,7 +1676,7 @@ int main (int argc, char * const * argv)
|
|||
std::cout << boost::str (boost::format ("%1% pending blocks validated\n") % count);
|
||||
}
|
||||
// Check block existance
|
||||
auto block (node->store.block.get (transaction, key.hash));
|
||||
auto block = node->ledger.block (transaction, key.hash);
|
||||
bool pruned (false);
|
||||
if (block == nullptr)
|
||||
{
|
||||
|
@ -1693,7 +1693,7 @@ int main (int argc, char * const * argv)
|
|||
bool previous_pruned = node->ledger.pruning && node->store.pruned.exists (transaction, block->previous ());
|
||||
if (previous_pruned)
|
||||
{
|
||||
block = node->store.block.get (transaction, key.hash);
|
||||
block = node->ledger.block (transaction, key.hash);
|
||||
}
|
||||
if (auto state = dynamic_cast<nano::state_block *> (block.get ()))
|
||||
{
|
||||
|
@ -1800,7 +1800,7 @@ int main (int argc, char * const * argv)
|
|||
while (!hash.is_zero ())
|
||||
{
|
||||
// Retrieving block data
|
||||
auto block (source_node->store.block.get (transaction, hash));
|
||||
auto block = source_node->ledger.block (transaction, hash);
|
||||
if (block != nullptr)
|
||||
{
|
||||
++count;
|
||||
|
|
|
@ -363,14 +363,14 @@ void nano::bulk_pull_server::set_current_end ()
|
|||
include_start = false;
|
||||
debug_assert (request != nullptr);
|
||||
auto transaction (node->store.tx_begin_read ());
|
||||
if (!node->store.block.exists (transaction, request->end))
|
||||
if (!node->ledger.block_exists (transaction, request->end))
|
||||
{
|
||||
node->logger.debug (nano::log::type::bulk_pull_server, "Bulk pull end block doesn't exist: {}, sending everything", request->end.to_string ());
|
||||
|
||||
request->end.clear ();
|
||||
}
|
||||
|
||||
if (node->store.block.exists (transaction, request->start.as_block_hash ()))
|
||||
if (node->ledger.block_exists (transaction, request->start.as_block_hash ()))
|
||||
{
|
||||
node->logger.debug (nano::log::type::bulk_pull_server, "Bulk pull request for block hash: {}", request->start.to_string ());
|
||||
|
||||
|
|
|
@ -192,7 +192,7 @@ nano::asc_pull_ack nano::bootstrap_server::process (store::transaction const & t
|
|||
{
|
||||
case asc_pull_req::hash_type::block:
|
||||
{
|
||||
if (store.block.exists (transaction, request.start.as_block_hash ()))
|
||||
if (ledger.block_exists (transaction, request.start.as_block_hash ()))
|
||||
{
|
||||
return prepare_response (transaction, id, request.start.as_block_hash (), count);
|
||||
}
|
||||
|
@ -253,13 +253,13 @@ std::vector<std::shared_ptr<nano::block>> nano::bootstrap_server::prepare_blocks
|
|||
std::vector<std::shared_ptr<nano::block>> result;
|
||||
if (!start_block.is_zero ())
|
||||
{
|
||||
std::shared_ptr<nano::block> current = store.block.get (transaction, start_block);
|
||||
std::shared_ptr<nano::block> current = ledger.block (transaction, start_block);
|
||||
while (current && result.size () < count)
|
||||
{
|
||||
result.push_back (current);
|
||||
|
||||
auto successor = current->sideband ().successor;
|
||||
current = store.block.get (transaction, successor);
|
||||
current = ledger.block (transaction, successor);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
|
@ -337,4 +337,4 @@ nano::asc_pull_ack nano::bootstrap_server::process (const store::transaction & t
|
|||
response.payload = response_payload;
|
||||
response.update_header ();
|
||||
return response;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -83,7 +83,7 @@ void nano::confirmation_height_bounded::process (std::shared_ptr<nano::block> or
|
|||
}
|
||||
else
|
||||
{
|
||||
block = ledger.store.block.get (transaction, current);
|
||||
block = ledger.block (transaction, current);
|
||||
}
|
||||
|
||||
if (!block)
|
||||
|
@ -227,7 +227,7 @@ nano::block_hash nano::confirmation_height_bounded::get_least_unconfirmed_hash_f
|
|||
{
|
||||
if (block_height_a > confirmation_height_info_a.height)
|
||||
{
|
||||
auto block (ledger.store.block.get (transaction_a, confirmation_height_info_a.frontier));
|
||||
auto block = ledger.block (transaction_a, confirmation_height_info_a.frontier);
|
||||
release_assert (block != nullptr);
|
||||
least_unconfirmed_hash = block->sideband ().successor;
|
||||
block_height_a = block->sideband ().height + 1;
|
||||
|
@ -255,14 +255,14 @@ bool nano::confirmation_height_bounded::iterate (store::read_transaction const &
|
|||
// Keep iterating upwards until we either reach the desired block or the second receive.
|
||||
// Once a receive is cemented, we can cement all blocks above it until the next receive, so store those details for later.
|
||||
++num_blocks;
|
||||
auto block = ledger.store.block.get (transaction_a, hash);
|
||||
auto block = ledger.block (transaction_a, hash);
|
||||
auto source (block->source ());
|
||||
if (source.is_zero ())
|
||||
{
|
||||
source = block->link ().as_block_hash ();
|
||||
}
|
||||
|
||||
if (!source.is_zero () && !ledger.is_epoch_link (source) && ledger.store.block.exists (transaction_a, source))
|
||||
if (!source.is_zero () && !ledger.is_epoch_link (source) && ledger.block_exists (transaction_a, source))
|
||||
{
|
||||
hit_receive = true;
|
||||
reached_target = true;
|
||||
|
@ -384,7 +384,7 @@ void nano::confirmation_height_bounded::cement_blocks (nano::write_guard & scope
|
|||
// Extra debug checks
|
||||
nano::confirmation_height_info confirmation_height_info;
|
||||
ledger.store.confirmation_height.get (transaction, account, confirmation_height_info);
|
||||
auto block (ledger.store.block.get (transaction, confirmed_frontier));
|
||||
auto block = ledger.block (transaction, confirmed_frontier);
|
||||
debug_assert (block != nullptr);
|
||||
debug_assert (block->sideband ().height == confirmation_height_info.height + num_blocks_cemented);
|
||||
#endif
|
||||
|
@ -414,14 +414,14 @@ void nano::confirmation_height_bounded::cement_blocks (nano::write_guard & scope
|
|||
}
|
||||
else
|
||||
{
|
||||
auto block = ledger.store.block.get (transaction, confirmation_height_info.frontier);
|
||||
auto block = ledger.block (transaction, confirmation_height_info.frontier);
|
||||
new_cemented_frontier = block->sideband ().successor;
|
||||
num_blocks_confirmed = pending.top_height - confirmation_height_info.height;
|
||||
start_height = confirmation_height_info.height + 1;
|
||||
}
|
||||
|
||||
auto total_blocks_cemented = 0;
|
||||
auto block = ledger.store.block.get (transaction, new_cemented_frontier);
|
||||
auto block = ledger.block (transaction, new_cemented_frontier);
|
||||
|
||||
// Cementing starts from the bottom of the chain and works upwards. This is because chains can have effectively
|
||||
// an infinite number of send/change blocks in a row. We don't want to hold the write transaction open for too long.
|
||||
|
@ -480,7 +480,7 @@ void nano::confirmation_height_bounded::cement_blocks (nano::write_guard & scope
|
|||
if (!last_iteration)
|
||||
{
|
||||
new_cemented_frontier = block->sideband ().successor;
|
||||
block = ledger.store.block.get (transaction, new_cemented_frontier);
|
||||
block = ledger.block (transaction, new_cemented_frontier);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -221,7 +221,7 @@ void nano::confirmation_height_unbounded::collect_unconfirmed_receive_and_source
|
|||
source = block->link ().as_block_hash ();
|
||||
}
|
||||
|
||||
if (!source.is_zero () && !ledger.is_epoch_link (source) && ledger.store.block.exists (transaction_a, source))
|
||||
if (!source.is_zero () && !ledger.is_epoch_link (source) && ledger.block_exists (transaction_a, source))
|
||||
{
|
||||
if (!hit_receive && !block_callback_data_a.empty ())
|
||||
{
|
||||
|
@ -376,7 +376,7 @@ void nano::confirmation_height_unbounded::cement_blocks (nano::write_guard & sco
|
|||
auto confirmation_height = confirmation_height_info.height;
|
||||
if (pending.height > confirmation_height)
|
||||
{
|
||||
auto block = ledger.store.block.get (transaction, pending.hash);
|
||||
auto block = ledger.block (transaction, pending.hash);
|
||||
debug_assert (ledger.pruning || block != nullptr);
|
||||
debug_assert (ledger.pruning || block->sideband ().height == pending.height);
|
||||
|
||||
|
@ -438,7 +438,7 @@ std::shared_ptr<nano::block> nano::confirmation_height_unbounded::get_block_and_
|
|||
}
|
||||
else
|
||||
{
|
||||
auto block (ledger.store.block.get (transaction_a, hash_a));
|
||||
auto block = ledger.block (transaction_a, hash_a);
|
||||
block_cache.emplace (hash_a, block);
|
||||
return block;
|
||||
}
|
||||
|
|
|
@ -397,7 +397,7 @@ uint64_t nano::json_handler::difficulty_ledger (nano::block const & block_a)
|
|||
auto previous (block_a.previous ());
|
||||
if (!previous.is_zero ())
|
||||
{
|
||||
block_previous = node.store.block.get (transaction, previous);
|
||||
block_previous = node.ledger.block (transaction, previous);
|
||||
}
|
||||
// Send check
|
||||
if (block_previous != nullptr)
|
||||
|
@ -413,7 +413,7 @@ uint64_t nano::json_handler::difficulty_ledger (nano::block const & block_a)
|
|||
auto link (block_a.link ());
|
||||
if (!link.is_zero () && !details.is_send)
|
||||
{
|
||||
auto block_link (node.store.block.get (transaction, link.as_block_hash ()));
|
||||
auto block_link = node.ledger.block (transaction, link.as_block_hash ());
|
||||
if (block_link != nullptr && node.store.pending.exists (transaction, nano::pending_key (block_a.account (), link.as_block_hash ())))
|
||||
{
|
||||
details.epoch = std::max (details.epoch, block_link->sideband ().details.epoch);
|
||||
|
@ -672,7 +672,7 @@ void nano::json_handler::account_info ()
|
|||
std::shared_ptr<nano::block> confirmed_frontier_block;
|
||||
if (include_confirmed && confirmation_height_info.height > 0)
|
||||
{
|
||||
confirmed_frontier_block = node.store.block.get (transaction, confirmation_height_info.frontier);
|
||||
confirmed_frontier_block = node.ledger.block (transaction, confirmation_height_info.frontier);
|
||||
}
|
||||
|
||||
if (representative)
|
||||
|
@ -686,7 +686,7 @@ void nano::json_handler::account_info ()
|
|||
confirmed_representative = confirmed_frontier_block->representative ();
|
||||
if (confirmed_representative.is_zero ())
|
||||
{
|
||||
confirmed_representative = node.store.block.get (transaction, node.ledger.representative (transaction, confirmation_height_info.frontier))->representative ();
|
||||
confirmed_representative = node.ledger.block (transaction, node.ledger.representative (transaction, confirmation_height_info.frontier))->representative ();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1145,7 +1145,7 @@ void nano::json_handler::block_info ()
|
|||
if (!ec)
|
||||
{
|
||||
auto transaction (node.store.tx_begin_read ());
|
||||
auto block (node.store.block.get (transaction, hash));
|
||||
auto block = node.ledger.block (transaction, hash);
|
||||
if (block != nullptr)
|
||||
{
|
||||
nano::account account (block->account ().is_zero () ? block->sideband ().account : block->account ());
|
||||
|
@ -1197,7 +1197,7 @@ void nano::json_handler::block_confirm ()
|
|||
if (!ec)
|
||||
{
|
||||
auto transaction (node.store.tx_begin_read ());
|
||||
auto block_l (node.store.block.get (transaction, hash));
|
||||
auto block_l = node.ledger.block (transaction, hash);
|
||||
if (block_l != nullptr)
|
||||
{
|
||||
if (!node.ledger.block_confirmed (transaction, hash))
|
||||
|
@ -1252,7 +1252,7 @@ void nano::json_handler::blocks ()
|
|||
nano::block_hash hash;
|
||||
if (!hash.decode_hex (hash_text))
|
||||
{
|
||||
auto block (node.store.block.get (transaction, hash));
|
||||
auto block = node.ledger.block (transaction, hash);
|
||||
if (block != nullptr)
|
||||
{
|
||||
if (json_block_l)
|
||||
|
@ -1303,7 +1303,7 @@ void nano::json_handler::blocks_info ()
|
|||
nano::block_hash hash;
|
||||
if (!hash.decode_hex (hash_text))
|
||||
{
|
||||
auto block (node.store.block.get (transaction, hash));
|
||||
auto block = node.ledger.block (transaction, hash);
|
||||
if (block != nullptr)
|
||||
{
|
||||
boost::property_tree::ptree entry;
|
||||
|
@ -1385,7 +1385,7 @@ void nano::json_handler::blocks_info ()
|
|||
if (source)
|
||||
{
|
||||
nano::block_hash source_hash (node.ledger.block_source (transaction, *block));
|
||||
auto block_a (node.store.block.get (transaction, source_hash));
|
||||
auto block_a = node.ledger.block (transaction, source_hash);
|
||||
if (block_a != nullptr)
|
||||
{
|
||||
auto source_account (node.ledger.account (transaction, source_hash));
|
||||
|
@ -1432,7 +1432,7 @@ void nano::json_handler::block_account ()
|
|||
if (!ec)
|
||||
{
|
||||
auto transaction (node.store.tx_begin_read ());
|
||||
if (node.store.block.exists (transaction, hash))
|
||||
if (node.ledger.block_exists (transaction, hash))
|
||||
{
|
||||
auto account (node.ledger.account (transaction, hash));
|
||||
response_l.put ("account", account.to_account ());
|
||||
|
@ -1652,7 +1652,7 @@ void nano::json_handler::block_create ()
|
|||
else if (previous_text.is_initialized () && balance_text.is_initialized () && type == "send")
|
||||
{
|
||||
auto transaction (node.store.tx_begin_read ());
|
||||
if (node.store.block.exists (transaction, previous) && node.ledger.balance (transaction, previous) != balance.number ())
|
||||
if (node.ledger.block_exists (transaction, previous) && node.ledger.balance (transaction, previous) != balance.number ())
|
||||
{
|
||||
ec = nano::error_rpc::block_create_balance_mismatch;
|
||||
}
|
||||
|
@ -1945,7 +1945,7 @@ void nano::json_handler::chain (bool successors)
|
|||
auto transaction (node.store.tx_begin_read ());
|
||||
while (!hash.is_zero () && blocks.size () < count)
|
||||
{
|
||||
auto block_l (node.store.block.get (transaction, hash));
|
||||
auto block_l = node.ledger.block (transaction, hash);
|
||||
if (block_l != nullptr)
|
||||
{
|
||||
if (offset > 0)
|
||||
|
@ -2605,7 +2605,7 @@ void nano::json_handler::account_history ()
|
|||
{
|
||||
if (!hash.decode_hex (*head_str))
|
||||
{
|
||||
if (node.store.block.exists (transaction, hash))
|
||||
if (node.ledger.block_exists (transaction, hash))
|
||||
{
|
||||
account = node.ledger.account (transaction, hash);
|
||||
}
|
||||
|
@ -2643,7 +2643,7 @@ void nano::json_handler::account_history ()
|
|||
boost::property_tree::ptree history;
|
||||
bool output_raw (request.get_optional<bool> ("raw") == true);
|
||||
response_l.put ("account", account.to_account ());
|
||||
auto block (node.store.block.get (transaction, hash));
|
||||
auto block = node.ledger.block (transaction, hash);
|
||||
while (block != nullptr && count > 0)
|
||||
{
|
||||
if (offset > 0)
|
||||
|
@ -2671,7 +2671,7 @@ void nano::json_handler::account_history ()
|
|||
}
|
||||
}
|
||||
hash = reverse ? node.store.block.successor (transaction, hash) : block->previous ();
|
||||
block = node.store.block.get (transaction, hash);
|
||||
block = node.ledger.block (transaction, hash);
|
||||
}
|
||||
response_l.add_child ("history", history);
|
||||
if (!hash.is_zero ())
|
||||
|
@ -3164,7 +3164,7 @@ void nano::json_handler::receivable_exists ()
|
|||
if (!ec)
|
||||
{
|
||||
auto transaction (node.store.tx_begin_read ());
|
||||
auto block (node.store.block.get (transaction, hash));
|
||||
auto block = node.ledger.block (transaction, hash);
|
||||
if (block != nullptr)
|
||||
{
|
||||
auto exists (false);
|
||||
|
@ -3198,7 +3198,7 @@ void nano::json_handler::process ()
|
|||
{
|
||||
std::shared_ptr<nano::state_block> block_state (std::static_pointer_cast<nano::state_block> (block));
|
||||
auto transaction (rpc_l->node.store.tx_begin_read ());
|
||||
if (!block_state->hashables.previous.is_zero () && !rpc_l->node.store.block.exists (transaction, block_state->hashables.previous))
|
||||
if (!block_state->hashables.previous.is_zero () && !rpc_l->node.ledger.block_exists (transaction, block_state->hashables.previous))
|
||||
{
|
||||
rpc_l->ec = nano::error_process::gap_previous;
|
||||
}
|
||||
|
@ -3638,28 +3638,28 @@ void nano::json_handler::republish ()
|
|||
{
|
||||
boost::property_tree::ptree blocks;
|
||||
auto transaction (node.store.tx_begin_read ());
|
||||
auto block (node.store.block.get (transaction, hash));
|
||||
auto block = node.ledger.block (transaction, hash);
|
||||
if (block != nullptr)
|
||||
{
|
||||
std::deque<std::shared_ptr<nano::block>> republish_bundle;
|
||||
for (auto i (0); !hash.is_zero () && i < count; ++i)
|
||||
{
|
||||
block = node.store.block.get (transaction, hash);
|
||||
block = node.ledger.block (transaction, hash);
|
||||
if (sources != 0) // Republish source chain
|
||||
{
|
||||
nano::block_hash source (node.ledger.block_source (transaction, *block));
|
||||
auto block_a (node.store.block.get (transaction, source));
|
||||
auto block_a = node.ledger.block (transaction, source);
|
||||
std::vector<nano::block_hash> hashes;
|
||||
while (block_a != nullptr && hashes.size () < sources)
|
||||
{
|
||||
hashes.push_back (source);
|
||||
source = block_a->previous ();
|
||||
block_a = node.store.block.get (transaction, source);
|
||||
block_a = node.ledger.block (transaction, source);
|
||||
}
|
||||
std::reverse (hashes.begin (), hashes.end ());
|
||||
for (auto & hash_l : hashes)
|
||||
{
|
||||
block_a = node.store.block.get (transaction, hash_l);
|
||||
block_a = node.ledger.block (transaction, hash_l);
|
||||
republish_bundle.push_back (std::move (block_a));
|
||||
boost::property_tree::ptree entry_l;
|
||||
entry_l.put ("", hash_l.to_string ());
|
||||
|
@ -3672,14 +3672,14 @@ void nano::json_handler::republish ()
|
|||
blocks.push_back (std::make_pair ("", entry));
|
||||
if (destinations != 0) // Republish destination chain
|
||||
{
|
||||
auto block_b (node.store.block.get (transaction, hash));
|
||||
auto block_b = node.ledger.block (transaction, hash);
|
||||
auto destination (node.ledger.block_destination (transaction, *block_b));
|
||||
if (!destination.is_zero ())
|
||||
{
|
||||
if (!node.store.pending.exists (transaction, nano::pending_key (destination, hash)))
|
||||
{
|
||||
nano::block_hash previous (node.ledger.latest (transaction, destination));
|
||||
auto block_d (node.store.block.get (transaction, previous));
|
||||
auto block_d = node.ledger.block (transaction, previous);
|
||||
nano::block_hash source;
|
||||
std::vector<nano::block_hash> hashes;
|
||||
while (block_d != nullptr && hash != source)
|
||||
|
@ -3687,7 +3687,7 @@ void nano::json_handler::republish ()
|
|||
hashes.push_back (previous);
|
||||
source = node.ledger.block_source (transaction, *block_d);
|
||||
previous = block_d->previous ();
|
||||
block_d = node.store.block.get (transaction, previous);
|
||||
block_d = node.ledger.block (transaction, previous);
|
||||
}
|
||||
std::reverse (hashes.begin (), hashes.end ());
|
||||
if (hashes.size () > destinations)
|
||||
|
@ -3696,7 +3696,7 @@ void nano::json_handler::republish ()
|
|||
}
|
||||
for (auto & hash_l : hashes)
|
||||
{
|
||||
block_d = node.store.block.get (transaction, hash_l);
|
||||
block_d = node.ledger.block (transaction, hash_l);
|
||||
republish_bundle.push_back (std::move (block_d));
|
||||
boost::property_tree::ptree entry_l;
|
||||
entry_l.put ("", hash_l.to_string ());
|
||||
|
@ -4658,7 +4658,7 @@ void nano::json_handler::wallet_history ()
|
|||
auto hash (info->head);
|
||||
while (timestamp >= modified_since && !hash.is_zero ())
|
||||
{
|
||||
auto block (node.store.block.get (block_transaction, hash));
|
||||
auto block = node.ledger.block (block_transaction, hash);
|
||||
timestamp = block->sideband ().timestamp;
|
||||
if (block != nullptr && timestamp >= modified_since)
|
||||
{
|
||||
|
@ -4932,7 +4932,7 @@ void nano::json_handler::wallet_republish ()
|
|||
while (!latest.is_zero () && hashes.size () < count)
|
||||
{
|
||||
hashes.push_back (latest);
|
||||
block = node.store.block.get (block_transaction, latest);
|
||||
block = node.ledger.block (block_transaction, latest);
|
||||
if (block != nullptr)
|
||||
{
|
||||
latest = block->previous ();
|
||||
|
@ -4945,7 +4945,7 @@ void nano::json_handler::wallet_republish ()
|
|||
std::reverse (hashes.begin (), hashes.end ());
|
||||
for (auto & hash : hashes)
|
||||
{
|
||||
block = node.store.block.get (block_transaction, hash);
|
||||
block = node.ledger.block (block_transaction, hash);
|
||||
republish_bundle.push_back (std::move (block));
|
||||
boost::property_tree::ptree entry;
|
||||
entry.put ("", hash.to_string ());
|
||||
|
@ -5093,7 +5093,7 @@ void nano::json_handler::work_generate ()
|
|||
{
|
||||
// Fetch account from block if not given
|
||||
auto transaction_l (node.store.tx_begin_read ());
|
||||
if (node.store.block.exists (transaction_l, hash))
|
||||
if (node.ledger.block_exists (transaction_l, hash))
|
||||
{
|
||||
account = node.ledger.account (transaction_l, hash);
|
||||
}
|
||||
|
@ -5463,7 +5463,7 @@ bool block_confirmed (nano::node & node, nano::store::transaction & transaction,
|
|||
// This just checks it's not currently undergoing an active transaction
|
||||
else if (!include_only_confirmed)
|
||||
{
|
||||
auto block (node.store.block.get (transaction, hash));
|
||||
auto block = node.ledger.block (transaction, hash);
|
||||
is_confirmed = (block != nullptr && !node.active.active (*block));
|
||||
}
|
||||
|
||||
|
|
|
@ -729,8 +729,7 @@ nano::uint128_t nano::node::balance (nano::account const & account_a)
|
|||
|
||||
std::shared_ptr<nano::block> nano::node::block (nano::block_hash const & hash_a)
|
||||
{
|
||||
auto const transaction (store.tx_begin_read ());
|
||||
return store.block.get (transaction, hash_a);
|
||||
return ledger.block (store.tx_begin_read (), hash_a);
|
||||
}
|
||||
|
||||
std::pair<nano::uint128_t, nano::uint128_t> nano::node::balance_pending (nano::account const & account_a, bool only_confirmed_a)
|
||||
|
@ -923,7 +922,7 @@ bool nano::node::collect_ledger_pruning_targets (std::deque<nano::block_hash> &
|
|||
uint64_t depth (0);
|
||||
while (!hash.is_zero () && depth < max_depth_a)
|
||||
{
|
||||
auto block (store.block.get (transaction, hash));
|
||||
auto block = ledger.block (transaction, hash);
|
||||
if (block != nullptr)
|
||||
{
|
||||
if (block->sideband ().timestamp > cutoff_time_a || depth == 0)
|
||||
|
@ -1273,7 +1272,7 @@ void nano::node::process_confirmed (nano::election_status const & status_a, uint
|
|||
{
|
||||
auto hash (status_a.winner->hash ());
|
||||
decltype (iteration_a) const num_iters = (config.block_processor_batch_max_time / network_params.node.process_confirmed_interval) * 4;
|
||||
if (auto block_l = ledger.store.block.get (ledger.store.tx_begin_read (), hash))
|
||||
if (auto block_l = ledger.block (ledger.store.tx_begin_read (), hash))
|
||||
{
|
||||
logger.trace (nano::log::type::node, nano::log::detail::process_confirmed, nano::log::arg{ "block", block_l });
|
||||
|
||||
|
|
|
@ -204,12 +204,12 @@ std::pair<std::vector<std::shared_ptr<nano::block>>, std::vector<std::shared_ptr
|
|||
if (!final_vote_hashes.empty ())
|
||||
{
|
||||
generate_final_vote = true;
|
||||
block = ledger.store.block.get (transaction, final_vote_hashes[0]);
|
||||
block = ledger.block (transaction, final_vote_hashes[0]);
|
||||
// Allow same root vote
|
||||
if (block != nullptr && final_vote_hashes.size () > 1)
|
||||
{
|
||||
to_generate_final.push_back (block);
|
||||
block = ledger.store.block.get (transaction, final_vote_hashes[1]);
|
||||
block = ledger.block (transaction, final_vote_hashes[1]);
|
||||
debug_assert (final_vote_hashes.size () == 2);
|
||||
}
|
||||
}
|
||||
|
@ -223,7 +223,7 @@ std::pair<std::vector<std::shared_ptr<nano::block>>, std::vector<std::shared_ptr
|
|||
// 4. Ledger by hash
|
||||
if (block == nullptr)
|
||||
{
|
||||
block = ledger.store.block.get (transaction, hash);
|
||||
block = ledger.block (transaction, hash);
|
||||
// Confirmation status. Generate final votes for confirmed
|
||||
if (block != nullptr)
|
||||
{
|
||||
|
@ -250,7 +250,7 @@ std::pair<std::vector<std::shared_ptr<nano::block>>, std::vector<std::shared_ptr
|
|||
}
|
||||
if (!successor.is_zero ())
|
||||
{
|
||||
auto successor_block = ledger.store.block.get (transaction, successor);
|
||||
auto successor_block = ledger.block (transaction, successor);
|
||||
debug_assert (successor_block != nullptr);
|
||||
block = std::move (successor_block);
|
||||
// 5. Votes in cache for successor
|
||||
|
|
|
@ -76,7 +76,7 @@ void nano::scheduler::hinted::activate (const nano::store::read_transaction & tr
|
|||
stack.pop ();
|
||||
|
||||
// Check if block exists
|
||||
if (auto block = node.store.block.get (transaction, current_hash); block)
|
||||
if (auto block = node.ledger.block (transaction, current_hash); block)
|
||||
{
|
||||
// Ensure block is not already confirmed
|
||||
if (node.block_confirmed_or_being_confirmed (transaction, current_hash))
|
||||
|
@ -283,4 +283,4 @@ nano::error nano::scheduler::hinted_config::deserialize (nano::tomlconfig & toml
|
|||
}
|
||||
|
||||
return toml.get_error ();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -47,7 +47,7 @@ bool nano::scheduler::priority::activate (nano::account const & account_a, store
|
|||
{
|
||||
debug_assert (conf_info.frontier != info->head);
|
||||
auto hash = conf_info.height == 0 ? info->open_block : node.store.block.successor (transaction, conf_info.frontier);
|
||||
auto block = node.store.block.get (transaction, hash);
|
||||
auto block = node.ledger.block (transaction, hash);
|
||||
debug_assert (block != nullptr);
|
||||
if (node.ledger.dependents_confirmed (transaction, *block))
|
||||
{
|
||||
|
|
|
@ -186,7 +186,7 @@ nano::vote_generator::~vote_generator ()
|
|||
|
||||
bool nano::vote_generator::should_vote (store::write_transaction const & transaction, nano::root const & root_a, nano::block_hash const & hash_a)
|
||||
{
|
||||
auto block = ledger.store.block.get (transaction, hash_a);
|
||||
auto block = ledger.block (transaction, hash_a);
|
||||
bool should_vote = false;
|
||||
if (is_final)
|
||||
{
|
||||
|
|
|
@ -955,7 +955,7 @@ std::shared_ptr<nano::block> nano::wallet::send_action (nano::account const & so
|
|||
if (status == 0)
|
||||
{
|
||||
nano::block_hash hash (result);
|
||||
block = wallets.node.store.block.get (block_transaction, hash);
|
||||
block = wallets.node.ledger.block (block_transaction, hash);
|
||||
if (block != nullptr)
|
||||
{
|
||||
cached_block = true;
|
||||
|
@ -1199,7 +1199,7 @@ bool nano::wallet::search_receivable (store::transaction const & wallet_transact
|
|||
}
|
||||
else if (!wallets.node.confirmation_height_processor.is_processing_block (hash))
|
||||
{
|
||||
auto block (wallets.node.store.block.get (block_transaction, hash));
|
||||
auto block = wallets.node.ledger.block (block_transaction, hash);
|
||||
if (block)
|
||||
{
|
||||
// Request confirmation for block which is not being processed yet
|
||||
|
|
|
@ -622,7 +622,7 @@ void nano_qt::history::refresh ()
|
|||
for (auto i (0), n (tx_count->value ()); i < n && !hash.is_zero (); ++i)
|
||||
{
|
||||
QList<QStandardItem *> items;
|
||||
auto block (ledger.store.block.get (transaction, hash));
|
||||
auto block (ledger.block (transaction, hash));
|
||||
if (block != nullptr)
|
||||
{
|
||||
block->visit (visitor);
|
||||
|
@ -671,7 +671,7 @@ nano_qt::block_viewer::block_viewer (nano_qt::wallet & wallet_a) :
|
|||
if (!hash_l.decode_hex (hash->text ().toStdString ()))
|
||||
{
|
||||
auto transaction (this->wallet.node.store.tx_begin_read ());
|
||||
auto block_l (this->wallet.node.store.block.get (transaction, hash_l));
|
||||
auto block_l (this->wallet.node.ledger.block (transaction, hash_l));
|
||||
if (block_l != nullptr)
|
||||
{
|
||||
std::string contents;
|
||||
|
@ -696,7 +696,7 @@ nano_qt::block_viewer::block_viewer (nano_qt::wallet & wallet_a) :
|
|||
if (!error)
|
||||
{
|
||||
auto transaction (this->wallet.node.store.tx_begin_read ());
|
||||
if (this->wallet.node.store.block.exists (transaction, block))
|
||||
if (this->wallet.node.ledger.block_exists (transaction, block))
|
||||
{
|
||||
rebroadcast->setEnabled (false);
|
||||
this->wallet.node.background ([this, block] () {
|
||||
|
@ -717,7 +717,7 @@ void nano_qt::block_viewer::rebroadcast_action (nano::block_hash const & hash_a)
|
|||
{
|
||||
auto done (true);
|
||||
auto transaction (wallet.node.ledger.store.tx_begin_read ());
|
||||
auto block (wallet.node.store.block.get (transaction, hash_a));
|
||||
auto block (wallet.node.ledger.block (transaction, hash_a));
|
||||
if (block != nullptr)
|
||||
{
|
||||
wallet.node.network.flood_block (block);
|
||||
|
@ -2299,7 +2299,7 @@ void nano_qt::block_creation::create_receive ()
|
|||
{
|
||||
auto transaction (wallet.node.wallets.tx_begin_read ());
|
||||
auto block_transaction (wallet.node.store.tx_begin_read ());
|
||||
auto block_l (wallet.node.store.block.get (block_transaction, source_l));
|
||||
auto block_l (wallet.node.ledger.block (block_transaction, source_l));
|
||||
if (block_l != nullptr)
|
||||
{
|
||||
auto const & destination (wallet.node.ledger.block_destination (block_transaction, *block_l));
|
||||
|
@ -2464,7 +2464,7 @@ void nano_qt::block_creation::create_open ()
|
|||
{
|
||||
auto transaction (wallet.node.wallets.tx_begin_read ());
|
||||
auto block_transaction (wallet.node.store.tx_begin_read ());
|
||||
auto block_l (wallet.node.store.block.get (block_transaction, source_l));
|
||||
auto block_l (wallet.node.ledger.block (block_transaction, source_l));
|
||||
if (block_l != nullptr)
|
||||
{
|
||||
auto const & destination (wallet.node.ledger.block_destination (block_transaction, *block_l));
|
||||
|
|
|
@ -389,7 +389,7 @@ TEST (wallet, DISABLED_process_block)
|
|||
{
|
||||
auto transaction (system.nodes[0]->store.tx_begin_read ());
|
||||
system.deadline_set (10s);
|
||||
while (system.nodes[0]->store.block.exists (transaction, send.hash ()))
|
||||
while (system.nodes[0]->ledger.block_exists (transaction, send.hash ()))
|
||||
{
|
||||
ASSERT_NO_ERROR (system.poll ());
|
||||
}
|
||||
|
|
|
@ -2395,7 +2395,7 @@ TEST (rpc, account_representative_set)
|
|||
wallet.insert_adhoc (key2.prv);
|
||||
auto key2_open_block_hash = wallet.send_sync (nano::dev::genesis_key.pub, key2.pub, node->config.receive_minimum.number ());
|
||||
ASSERT_TIMELY (5s, node->ledger.block_confirmed (node->store.tx_begin_read (), key2_open_block_hash));
|
||||
auto key2_open_block = node->store.block.get (node->store.tx_begin_read (), key2_open_block_hash);
|
||||
auto key2_open_block = node->ledger.block (node->store.tx_begin_read (), key2_open_block_hash);
|
||||
ASSERT_EQ (nano::dev::genesis_key.pub, key2_open_block->representative ());
|
||||
|
||||
// now change the representative of key2 to be genesis
|
||||
|
@ -2412,7 +2412,7 @@ TEST (rpc, account_representative_set)
|
|||
nano::block_hash hash;
|
||||
ASSERT_FALSE (hash.decode_hex (block_text1));
|
||||
ASSERT_FALSE (hash.is_zero ());
|
||||
auto block = node->store.block.get (node->store.tx_begin_read (), hash);
|
||||
auto block = node->ledger.block (node->store.tx_begin_read (), hash);
|
||||
ASSERT_NE (block, nullptr);
|
||||
ASSERT_TIMELY (5s, node->ledger.block_confirmed (node->store.tx_begin_read (), hash));
|
||||
ASSERT_EQ (key2.pub, block->representative ());
|
||||
|
@ -4292,7 +4292,7 @@ TEST (rpc, block_info_pruning)
|
|||
{
|
||||
auto transaction (node1->store.tx_begin_write ());
|
||||
ASSERT_EQ (1, node1->ledger.pruning_action (transaction, send1->hash (), 1));
|
||||
ASSERT_TRUE (node1->store.block.exists (transaction, receive1->hash ()));
|
||||
ASSERT_TRUE (node1->ledger.block_exists (transaction, receive1->hash ()));
|
||||
}
|
||||
auto const rpc_ctx = add_rpc (system, node1);
|
||||
// Pruned block
|
||||
|
@ -4358,7 +4358,7 @@ TEST (rpc, pruned_exists)
|
|||
{
|
||||
auto transaction (node1->store.tx_begin_write ());
|
||||
ASSERT_EQ (1, node1->ledger.pruning_action (transaction, send1->hash (), 1));
|
||||
ASSERT_TRUE (node1->store.block.exists (transaction, receive1->hash ()));
|
||||
ASSERT_TRUE (node1->ledger.block_exists (transaction, receive1->hash ()));
|
||||
}
|
||||
auto const rpc_ctx = add_rpc (system, node1);
|
||||
// Pruned block
|
||||
|
@ -5228,7 +5228,7 @@ TEST (rpc, confirmation_height_currently_processing)
|
|||
std::shared_ptr<nano::block> frontier;
|
||||
{
|
||||
auto transaction = node->store.tx_begin_read ();
|
||||
frontier = node->store.block.get (transaction, previous_genesis_chain_hash);
|
||||
frontier = node->ledger.block (transaction, previous_genesis_chain_hash);
|
||||
}
|
||||
|
||||
boost::property_tree::ptree request;
|
||||
|
@ -6558,7 +6558,7 @@ TEST (rpc, receive_unopened)
|
|||
auto send1 (wallet->send_action (nano::dev::genesis_key.pub, key1.pub, node->config.receive_minimum.number () - 1, *node->work_generate_blocking (nano::dev::genesis->hash ())));
|
||||
ASSERT_TIMELY (5s, !node->balance (nano::dev::genesis_key.pub) != nano::dev::constants.genesis_amount);
|
||||
ASSERT_FALSE (node->store.account.exists (node->store.tx_begin_read (), key1.pub));
|
||||
ASSERT_TRUE (node->store.block.exists (node->store.tx_begin_read (), send1->hash ()));
|
||||
ASSERT_TRUE (node->ledger.block_exists (node->store.tx_begin_read (), send1->hash ()));
|
||||
wallet->insert_adhoc (key1.prv); // should not auto receive, amount sent was lower than minimum
|
||||
auto const rpc_ctx = add_rpc (system, node);
|
||||
boost::property_tree::ptree request;
|
||||
|
@ -6582,7 +6582,7 @@ TEST (rpc, receive_unopened)
|
|||
auto send2 (wallet->send_action (nano::dev::genesis_key.pub, key2.pub, node->config.receive_minimum.number () - 1, *node->work_generate_blocking (send1->hash ())));
|
||||
ASSERT_TIMELY (5s, !node->balance (nano::dev::genesis_key.pub) != prev_amount);
|
||||
ASSERT_FALSE (node->store.account.exists (node->store.tx_begin_read (), key2.pub));
|
||||
ASSERT_TRUE (node->store.block.exists (node->store.tx_begin_read (), send2->hash ()));
|
||||
ASSERT_TRUE (node->ledger.block_exists (node->store.tx_begin_read (), send2->hash ()));
|
||||
nano::public_key rep;
|
||||
wallet->store.representative_set (node->wallets.tx_begin_write (), rep);
|
||||
wallet->insert_adhoc (key2.prv); // should not auto receive, amount sent was lower than minimum
|
||||
|
@ -6617,7 +6617,7 @@ TEST (rpc, receive_work_disabled)
|
|||
ASSERT_NE (send1, nullptr);
|
||||
ASSERT_TIMELY (5s, node->balance (nano::dev::genesis_key.pub) != nano::dev::constants.genesis_amount);
|
||||
ASSERT_FALSE (node->store.account.exists (node->store.tx_begin_read (), key1.pub));
|
||||
ASSERT_TRUE (node->store.block.exists (node->store.tx_begin_read (), send1->hash ()));
|
||||
ASSERT_TRUE (node->ledger.block_exists (node->store.tx_begin_read (), send1->hash ()));
|
||||
wallet->insert_adhoc (key1.prv);
|
||||
auto const rpc_ctx = add_rpc (system, node);
|
||||
boost::property_tree::ptree request;
|
||||
|
@ -6662,9 +6662,9 @@ TEST (rpc, receive_pruned)
|
|||
}
|
||||
ASSERT_EQ (2, node2->ledger.cache.pruned_count);
|
||||
ASSERT_TRUE (node2->ledger.block_or_pruned_exists (send1->hash ()));
|
||||
ASSERT_FALSE (node2->store.block.exists (node2->store.tx_begin_read (), send1->hash ()));
|
||||
ASSERT_FALSE (node2->ledger.block_exists (node2->store.tx_begin_read (), send1->hash ()));
|
||||
ASSERT_TRUE (node2->ledger.block_or_pruned_exists (send2->hash ()));
|
||||
ASSERT_FALSE (node2->store.block.exists (node2->store.tx_begin_read (), send2->hash ()));
|
||||
ASSERT_FALSE (node2->ledger.block_exists (node2->store.tx_begin_read (), send2->hash ()));
|
||||
ASSERT_TRUE (node2->ledger.block_or_pruned_exists (send3->hash ()));
|
||||
|
||||
auto const rpc_ctx = add_rpc (system, node2);
|
||||
|
|
|
@ -695,7 +695,7 @@ ledger_processor::ledger_processor (nano::ledger & ledger_a, nano::store::write_
|
|||
class representative_visitor final : public nano::block_visitor
|
||||
{
|
||||
public:
|
||||
representative_visitor (nano::store::transaction const & transaction_a, nano::store::component & store_a);
|
||||
representative_visitor (nano::store::transaction const & transaction_a, nano::ledger & ledger);
|
||||
~representative_visitor () = default;
|
||||
void compute (nano::block_hash const & hash_a);
|
||||
void send_block (nano::send_block const & block_a) override;
|
||||
|
@ -704,15 +704,15 @@ public:
|
|||
void change_block (nano::change_block const & block_a) override;
|
||||
void state_block (nano::state_block const & block_a) override;
|
||||
nano::store::transaction const & transaction;
|
||||
nano::store::component & store;
|
||||
nano::ledger & ledger;
|
||||
nano::block_hash current;
|
||||
nano::block_hash result;
|
||||
};
|
||||
|
||||
representative_visitor::representative_visitor (nano::store::transaction const & transaction_a, nano::store::component & store_a) :
|
||||
transaction (transaction_a),
|
||||
store (store_a),
|
||||
result (0)
|
||||
representative_visitor::representative_visitor (nano::store::transaction const & transaction_a, nano::ledger & ledger) :
|
||||
transaction{ transaction_a },
|
||||
ledger{ ledger },
|
||||
result{ 0 }
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -721,9 +721,9 @@ void representative_visitor::compute (nano::block_hash const & hash_a)
|
|||
current = hash_a;
|
||||
while (result.is_zero ())
|
||||
{
|
||||
auto block (store.block.get (transaction, current));
|
||||
debug_assert (block != nullptr);
|
||||
block->visit (*this);
|
||||
auto block_l = ledger.block (transaction, current);
|
||||
debug_assert (block_l != nullptr);
|
||||
block_l->visit (*this);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -840,15 +840,15 @@ nano::uint128_t nano::ledger::balance (store::transaction const & transaction, n
|
|||
{
|
||||
return 0;
|
||||
}
|
||||
auto block = store.block.get (transaction, hash);
|
||||
debug_assert (block != nullptr);
|
||||
return balance (*block);
|
||||
auto block_l = block (transaction, hash);
|
||||
debug_assert (block_l != nullptr);
|
||||
return balance (*block_l);
|
||||
}
|
||||
|
||||
nano::uint128_t nano::ledger::balance_safe (store::transaction const & transaction_a, nano::block_hash const & hash_a, bool & error_a) const
|
||||
{
|
||||
nano::uint128_t result (0);
|
||||
if (pruning && !hash_a.is_zero () && !store.block.exists (transaction_a, hash_a))
|
||||
if (pruning && !hash_a.is_zero () && !block_exists (transaction_a, hash_a))
|
||||
{
|
||||
error_a = true;
|
||||
result = 0;
|
||||
|
@ -860,6 +860,16 @@ nano::uint128_t nano::ledger::balance_safe (store::transaction const & transacti
|
|||
return result;
|
||||
}
|
||||
|
||||
std::shared_ptr<nano::block> nano::ledger::block (store::transaction const & transaction, nano::block_hash const & hash) const
|
||||
{
|
||||
return store.block.get (transaction, hash);
|
||||
}
|
||||
|
||||
bool nano::ledger::block_exists (store::transaction const & transaction, nano::block_hash const & hash) const
|
||||
{
|
||||
return store.block.exists (transaction, hash);
|
||||
}
|
||||
|
||||
// Balance for an account by account number
|
||||
nano::uint128_t nano::ledger::account_balance (store::transaction const & transaction_a, nano::account const & account_a, bool only_confirmed_a)
|
||||
{
|
||||
|
@ -930,13 +940,13 @@ nano::block_status nano::ledger::process (store::write_transaction const & trans
|
|||
nano::block_hash nano::ledger::representative (store::transaction const & transaction_a, nano::block_hash const & hash_a)
|
||||
{
|
||||
auto result (representative_calculated (transaction_a, hash_a));
|
||||
debug_assert (result.is_zero () || store.block.exists (transaction_a, result));
|
||||
debug_assert (result.is_zero () || block_exists (transaction_a, result));
|
||||
return result;
|
||||
}
|
||||
|
||||
nano::block_hash nano::ledger::representative_calculated (store::transaction const & transaction_a, nano::block_hash const & hash_a)
|
||||
{
|
||||
representative_visitor visitor (transaction_a, store);
|
||||
representative_visitor visitor (transaction_a, *this);
|
||||
visitor.compute (hash_a);
|
||||
return visitor.result;
|
||||
}
|
||||
|
@ -952,12 +962,12 @@ bool nano::ledger::block_or_pruned_exists (store::transaction const & transactio
|
|||
{
|
||||
return true;
|
||||
}
|
||||
return store.block.exists (transaction_a, hash_a);
|
||||
return block_exists (transaction_a, hash_a);
|
||||
}
|
||||
|
||||
bool nano::ledger::root_exists (store::transaction const & transaction_a, nano::root const & root_a)
|
||||
{
|
||||
return store.block.exists (transaction_a, root_a.as_block_hash ()) || store.account.exists (transaction_a, root_a.as_account ());
|
||||
return block_exists (transaction_a, root_a.as_block_hash ()) || store.account.exists (transaction_a, root_a.as_account ());
|
||||
}
|
||||
|
||||
std::string nano::ledger::block_text (char const * hash_a)
|
||||
|
@ -969,10 +979,10 @@ std::string nano::ledger::block_text (nano::block_hash const & hash_a)
|
|||
{
|
||||
std::string result;
|
||||
auto transaction (store.tx_begin_read ());
|
||||
auto block (store.block.get (transaction, hash_a));
|
||||
if (block != nullptr)
|
||||
auto block_l = block (transaction, hash_a);
|
||||
if (block_l != nullptr)
|
||||
{
|
||||
block->serialize_json (result);
|
||||
block_l->serialize_json (result);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
@ -989,7 +999,7 @@ bool nano::ledger::is_send (store::transaction const & transaction_a, nano::bloc
|
|||
* requires that the previous block exists in the database.
|
||||
* This is because it must retrieve the balance of the previous block.
|
||||
*/
|
||||
debug_assert (block_a.has_sideband () || previous.is_zero () || store.block.exists (transaction_a, previous));
|
||||
debug_assert (block_a.has_sideband () || previous.is_zero () || block_exists (transaction_a, previous));
|
||||
|
||||
bool result (false);
|
||||
if (block_a.has_sideband ())
|
||||
|
@ -1032,7 +1042,7 @@ nano::block_hash nano::ledger::block_source (store::transaction const & transact
|
|||
* passed in exist in the database. This is because it will try
|
||||
* to check account balances to determine if it is a send block.
|
||||
*/
|
||||
debug_assert (block_a.previous ().is_zero () || store.block.exists (transaction_a, block_a.previous ()));
|
||||
debug_assert (block_a.previous ().is_zero () || block_exists (transaction_a, block_a.previous ()));
|
||||
|
||||
// If block_a.source () is nonzero, then we have our source.
|
||||
// However, universal blocks will always return zero.
|
||||
|
@ -1098,12 +1108,12 @@ nano::uint128_t nano::ledger::weight (nano::account const & account_a)
|
|||
// Rollback blocks until `block_a' doesn't exist or it tries to penetrate the confirmation height
|
||||
bool nano::ledger::rollback (store::write_transaction const & transaction_a, nano::block_hash const & block_a, std::vector<std::shared_ptr<nano::block>> & list_a)
|
||||
{
|
||||
debug_assert (store.block.exists (transaction_a, block_a));
|
||||
debug_assert (block_exists (transaction_a, block_a));
|
||||
auto account_l (account (transaction_a, block_a));
|
||||
auto block_account_height (height (transaction_a, block_a));
|
||||
rollback_visitor rollback (transaction_a, *this, list_a);
|
||||
auto error (false);
|
||||
while (!error && store.block.exists (transaction_a, block_a))
|
||||
while (!error && block_exists (transaction_a, block_a))
|
||||
{
|
||||
nano::confirmation_height_info confirmation_height_info;
|
||||
store.confirmation_height.get (transaction_a, account_l, confirmation_height_info);
|
||||
|
@ -1111,9 +1121,9 @@ bool nano::ledger::rollback (store::write_transaction const & transaction_a, nan
|
|||
{
|
||||
auto info = account_info (transaction_a, account_l);
|
||||
debug_assert (info);
|
||||
auto block (store.block.get (transaction_a, info->head));
|
||||
list_a.push_back (block);
|
||||
block->visit (rollback);
|
||||
auto block_l = block (transaction_a, info->head);
|
||||
list_a.push_back (block_l);
|
||||
block_l->visit (rollback);
|
||||
error = rollback.error;
|
||||
if (!error)
|
||||
{
|
||||
|
@ -1148,9 +1158,9 @@ nano::account nano::ledger::account (nano::block const & block) const
|
|||
|
||||
nano::account nano::ledger::account (store::transaction const & transaction, nano::block_hash const & hash) const
|
||||
{
|
||||
auto block = store.block.get (transaction, hash);
|
||||
debug_assert (block != nullptr);
|
||||
return account (*block);
|
||||
auto block_l = block (transaction, hash);
|
||||
debug_assert (block_l != nullptr);
|
||||
return account (*block_l);
|
||||
}
|
||||
|
||||
nano::account nano::ledger::account_safe (store::transaction const & transaction_a, nano::block_hash const & hash_a, bool & error_a) const
|
||||
|
@ -1161,10 +1171,10 @@ nano::account nano::ledger::account_safe (store::transaction const & transaction
|
|||
}
|
||||
else
|
||||
{
|
||||
auto block (store.block.get (transaction_a, hash_a));
|
||||
if (block != nullptr)
|
||||
auto block_l = block (transaction_a, hash_a);
|
||||
if (block_l != nullptr)
|
||||
{
|
||||
return account (*block);
|
||||
return account (*block_l);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1176,10 +1186,10 @@ nano::account nano::ledger::account_safe (store::transaction const & transaction
|
|||
|
||||
nano::account nano::ledger::account_safe (store::transaction const & transaction, nano::block_hash const & hash) const
|
||||
{
|
||||
auto block = store.block.get (transaction, hash);
|
||||
if (block)
|
||||
auto block_l = block (transaction, hash);
|
||||
if (block_l)
|
||||
{
|
||||
return account (*block);
|
||||
return account (*block_l);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1194,18 +1204,18 @@ std::optional<nano::account_info> nano::ledger::account_info (store::transaction
|
|||
|
||||
nano::uint128_t nano::ledger::amount (store::transaction const & transaction_a, nano::block_hash const & hash_a)
|
||||
{
|
||||
auto block (store.block.get (transaction_a, hash_a));
|
||||
auto block_l = block (transaction_a, hash_a);
|
||||
auto block_balance (balance (transaction_a, hash_a));
|
||||
auto previous_balance (balance (transaction_a, block->previous ()));
|
||||
auto previous_balance (balance (transaction_a, block_l->previous ()));
|
||||
return block_balance > previous_balance ? block_balance - previous_balance : previous_balance - block_balance;
|
||||
}
|
||||
|
||||
nano::uint128_t nano::ledger::amount_safe (store::transaction const & transaction_a, nano::block_hash const & hash_a, bool & error_a) const
|
||||
{
|
||||
auto block (store.block.get (transaction_a, hash_a));
|
||||
debug_assert (block);
|
||||
auto block_l = block (transaction_a, hash_a);
|
||||
debug_assert (block_l);
|
||||
auto block_balance (balance (transaction_a, hash_a));
|
||||
auto previous_balance (balance_safe (transaction_a, block->previous (), error_a));
|
||||
auto previous_balance (balance_safe (transaction_a, block_l->previous (), error_a));
|
||||
return error_a ? 0 : block_balance > previous_balance ? block_balance - previous_balance
|
||||
: previous_balance - block_balance;
|
||||
}
|
||||
|
@ -1237,10 +1247,10 @@ void nano::ledger::dump_account_chain (nano::account const & account_a, std::ost
|
|||
auto hash (latest (transaction, account_a));
|
||||
while (!hash.is_zero ())
|
||||
{
|
||||
auto block (store.block.get (transaction, hash));
|
||||
debug_assert (block != nullptr);
|
||||
auto block_l = block (transaction, hash);
|
||||
debug_assert (block_l != nullptr);
|
||||
stream << hash.to_string () << std::endl;
|
||||
hash = block->previous ();
|
||||
hash = block_l->previous ();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1296,7 +1306,7 @@ public:
|
|||
result[0] = block_a.hashables.previous;
|
||||
result[1] = block_a.hashables.link.as_block_hash ();
|
||||
// ledger.is_send will check the sideband first, if block_a has a loaded sideband the check that previous block exists can be skipped
|
||||
if (ledger.is_epoch_link (block_a.hashables.link) || ((block_a.has_sideband () || ledger.store.block.exists (transaction, block_a.hashables.previous)) && ledger.is_send (transaction, block_a)))
|
||||
if (ledger.is_epoch_link (block_a.hashables.link) || ((block_a.has_sideband () || ledger.block_exists (transaction, block_a.hashables.previous)) && ledger.is_send (transaction, block_a)))
|
||||
{
|
||||
result[1].clear ();
|
||||
}
|
||||
|
@ -1328,7 +1338,7 @@ std::shared_ptr<nano::block> nano::ledger::find_receive_block_by_send_hash (stor
|
|||
{
|
||||
return nullptr;
|
||||
}
|
||||
auto possible_receive_block = store.block.get (transaction, info.frontier);
|
||||
auto possible_receive_block = block (transaction, info.frontier);
|
||||
|
||||
// walk down the chain until the source field of a receive block matches the send block hash
|
||||
while (possible_receive_block != nullptr)
|
||||
|
@ -1355,7 +1365,7 @@ std::shared_ptr<nano::block> nano::ledger::find_receive_block_by_send_hash (stor
|
|||
break;
|
||||
}
|
||||
|
||||
possible_receive_block = store.block.get (transaction, possible_receive_block->previous ());
|
||||
possible_receive_block = block (transaction, possible_receive_block->previous ());
|
||||
}
|
||||
|
||||
return result;
|
||||
|
@ -1423,7 +1433,7 @@ std::shared_ptr<nano::block> nano::ledger::successor (store::transaction const &
|
|||
std::shared_ptr<nano::block> result;
|
||||
if (!successor.is_zero ())
|
||||
{
|
||||
result = store.block.get (transaction_a, successor);
|
||||
result = block (transaction_a, successor);
|
||||
}
|
||||
debug_assert (successor.is_zero () || result != nullptr);
|
||||
return result;
|
||||
|
@ -1431,15 +1441,15 @@ std::shared_ptr<nano::block> nano::ledger::successor (store::transaction const &
|
|||
|
||||
std::shared_ptr<nano::block> nano::ledger::forked_block (store::transaction const & transaction_a, nano::block const & block_a)
|
||||
{
|
||||
debug_assert (!store.block.exists (transaction_a, block_a.hash ()));
|
||||
debug_assert (!block_exists (transaction_a, block_a.hash ()));
|
||||
auto root (block_a.root ());
|
||||
debug_assert (store.block.exists (transaction_a, root.as_block_hash ()) || store.account.exists (transaction_a, root.as_account ()));
|
||||
auto result (store.block.get (transaction_a, store.block.successor (transaction_a, root.as_block_hash ())));
|
||||
debug_assert (block_exists (transaction_a, root.as_block_hash ()) || store.account.exists (transaction_a, root.as_account ()));
|
||||
auto result = block (transaction_a, store.block.successor (transaction_a, root.as_block_hash ()));
|
||||
if (result == nullptr)
|
||||
{
|
||||
auto info = account_info (transaction_a, root.as_account ());
|
||||
debug_assert (info);
|
||||
result = store.block.get (transaction_a, info->open_block);
|
||||
result = block (transaction_a, info->open_block);
|
||||
debug_assert (result != nullptr);
|
||||
}
|
||||
return result;
|
||||
|
@ -1450,7 +1460,7 @@ std::shared_ptr<nano::block> nano::ledger::head_block (store::transaction const
|
|||
auto info = store.account.get (transaction, account);
|
||||
if (info)
|
||||
{
|
||||
return store.block.get (transaction, info->head);
|
||||
return block (transaction, info->head);
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -1461,12 +1471,12 @@ bool nano::ledger::block_confirmed (store::transaction const & transaction_a, na
|
|||
{
|
||||
return true;
|
||||
}
|
||||
auto block = store.block.get (transaction_a, hash_a);
|
||||
if (block)
|
||||
auto block_l = block (transaction_a, hash_a);
|
||||
if (block_l)
|
||||
{
|
||||
nano::confirmation_height_info confirmation_height_info;
|
||||
store.confirmation_height.get (transaction_a, block->account ().is_zero () ? block->sideband ().account : block->account (), confirmation_height_info);
|
||||
auto confirmed (confirmation_height_info.height >= block->sideband ().height);
|
||||
store.confirmation_height.get (transaction_a, block_l->account ().is_zero () ? block_l->sideband ().account : block_l->account (), confirmation_height_info);
|
||||
auto confirmed (confirmation_height_info.height >= block_l->sideband ().height);
|
||||
return confirmed;
|
||||
}
|
||||
return false;
|
||||
|
@ -1478,12 +1488,12 @@ uint64_t nano::ledger::pruning_action (store::write_transaction & transaction_a,
|
|||
nano::block_hash hash (hash_a);
|
||||
while (!hash.is_zero () && hash != constants.genesis->hash ())
|
||||
{
|
||||
auto block (store.block.get (transaction_a, hash));
|
||||
if (block != nullptr)
|
||||
auto block_l = block (transaction_a, hash);
|
||||
if (block_l != nullptr)
|
||||
{
|
||||
store.block.del (transaction_a, hash);
|
||||
store.pruned.put (transaction_a, hash);
|
||||
hash = block->previous ();
|
||||
hash = block_l->previous ();
|
||||
++pruned_count;
|
||||
++cache.pruned_count;
|
||||
if (pruned_count % batch_size_a == 0)
|
||||
|
@ -1685,18 +1695,18 @@ nano::epoch nano::ledger::version (nano::block const & block)
|
|||
|
||||
nano::epoch nano::ledger::version (store::transaction const & transaction, nano::block_hash const & hash) const
|
||||
{
|
||||
auto block = store.block.get (transaction, hash);
|
||||
if (block == nullptr)
|
||||
auto block_l = block (transaction, hash);
|
||||
if (block_l == nullptr)
|
||||
{
|
||||
return nano::epoch::epoch_0;
|
||||
}
|
||||
return version (*block);
|
||||
return version (*block_l);
|
||||
}
|
||||
|
||||
uint64_t nano::ledger::height (store::transaction const & transaction, nano::block_hash const & hash) const
|
||||
{
|
||||
auto block = store.block.get (transaction, hash);
|
||||
return block->sideband ().height;
|
||||
auto block_l = block (transaction, hash);
|
||||
return block_l->sideband ().height;
|
||||
}
|
||||
|
||||
nano::uncemented_info::uncemented_info (nano::block_hash const & cemented_frontier, nano::block_hash const & frontier, nano::account const & account) :
|
||||
|
|
|
@ -51,6 +51,8 @@ public:
|
|||
static nano::uint128_t balance (nano::block const & block);
|
||||
nano::uint128_t balance (store::transaction const &, nano::block_hash const &) const;
|
||||
nano::uint128_t balance_safe (store::transaction const &, nano::block_hash const &, bool &) const;
|
||||
std::shared_ptr<nano::block> block (store::transaction const & transaction, nano::block_hash const & hash) const;
|
||||
bool block_exists (store::transaction const & transaction, nano::block_hash const & hash) const;
|
||||
nano::uint128_t account_balance (store::transaction const &, nano::account const &, bool = false);
|
||||
nano::uint128_t account_receivable (store::transaction const &, nano::account const &, bool = false);
|
||||
nano::uint128_t weight (nano::account const &);
|
||||
|
|
|
@ -100,7 +100,7 @@ TEST (system, receive_while_synchronizing)
|
|||
node1->workers.add_timed_task (std::chrono::steady_clock::now () + std::chrono::milliseconds (200), ([&system, &key] () {
|
||||
auto hash (system.wallet (0)->send_sync (nano::dev::genesis_key.pub, key.pub, system.nodes[0]->config.receive_minimum.number ()));
|
||||
auto transaction (system.nodes[0]->store.tx_begin_read ());
|
||||
auto block (system.nodes[0]->store.block.get (transaction, hash));
|
||||
auto block = system.nodes[0]->ledger.block (transaction, hash);
|
||||
std::string block_text;
|
||||
block->serialize_json (block_text);
|
||||
}));
|
||||
|
@ -2162,7 +2162,7 @@ TEST (node, wallet_create_block_confirm_conflicts)
|
|||
|
||||
// Call block confirm on the top level send block which will confirm everything underneath on both accounts.
|
||||
{
|
||||
auto block = node->store.block.get (node->store.tx_begin_read (), latest);
|
||||
auto block = node->ledger.block (node->store.tx_begin_read (), latest);
|
||||
node->scheduler.manual.push (block);
|
||||
std::shared_ptr<nano::election> election;
|
||||
ASSERT_TIMELY (10s, (election = node->active.election (block->qualified_root ())) != nullptr);
|
||||
|
|
|
@ -416,7 +416,7 @@ void nano::test::system::generate_receive (nano::node & node_a)
|
|||
if (i != node_a.store.pending.end ())
|
||||
{
|
||||
nano::pending_key const & send_hash (i->first);
|
||||
send_block = node_a.store.block.get (transaction, send_hash.hash);
|
||||
send_block = node_a.ledger.block (transaction, send_hash.hash);
|
||||
}
|
||||
}
|
||||
if (send_block != nullptr)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue