Moving account_hight off of store and on to ledger.
This commit is contained in:
parent
2d8dc01d51
commit
bd3c6b2516
8 changed files with 9 additions and 21 deletions
|
@ -307,7 +307,7 @@ void nano::confirmation_height_bounded::prepare_iterated_blocks_for_cementing (p
|
|||
if (!preparation_data_a.already_cemented)
|
||||
{
|
||||
// Add the non-receive blocks iterated for this account
|
||||
auto block_height = (ledger.store.block.account_height (preparation_data_a.transaction, preparation_data_a.top_most_non_receive_block_hash));
|
||||
auto block_height = (ledger.height (preparation_data_a.transaction, preparation_data_a.top_most_non_receive_block_hash));
|
||||
if (block_height > preparation_data_a.confirmation_height_info.height)
|
||||
{
|
||||
confirmed_info confirmed_info_l{ block_height, preparation_data_a.top_most_non_receive_block_hash };
|
||||
|
|
|
@ -156,13 +156,6 @@ void nano::lmdb::block_store::for_each_par (std::function<void (nano::read_trans
|
|||
});
|
||||
}
|
||||
|
||||
// Converts a block hash to a block height
|
||||
uint64_t nano::lmdb::block_store::account_height (nano::transaction const & transaction_a, nano::block_hash const & hash_a) const
|
||||
{
|
||||
auto block = get (transaction_a, hash_a);
|
||||
return block->sideband ().height;
|
||||
}
|
||||
|
||||
void nano::lmdb::block_store::block_raw_get (nano::transaction const & transaction, nano::block_hash const & hash, nano::mdb_val & value) const
|
||||
{
|
||||
auto status = store.get (transaction, tables::blocks, hash, value);
|
||||
|
|
|
@ -31,8 +31,6 @@ namespace lmdb
|
|||
nano::store_iterator<nano::block_hash, nano::block_w_sideband> begin (nano::transaction const & transaction_a, nano::block_hash const & hash_a) const override;
|
||||
nano::store_iterator<nano::block_hash, nano::block_w_sideband> end () const override;
|
||||
void for_each_par (std::function<void (nano::read_transaction const &, nano::store_iterator<nano::block_hash, block_w_sideband>, nano::store_iterator<nano::block_hash, block_w_sideband>)> const & action_a) const override;
|
||||
// Converts a block hash to a block height
|
||||
uint64_t account_height (nano::transaction const & transaction_a, nano::block_hash const & hash_a) const override;
|
||||
|
||||
/**
|
||||
* Maps block hash to send block. (Removed)
|
||||
|
|
|
@ -156,13 +156,6 @@ void nano::rocksdb::block_store::for_each_par (std::function<void (nano::read_tr
|
|||
});
|
||||
}
|
||||
|
||||
// Converts a block hash to a block height
|
||||
uint64_t nano::rocksdb::block_store::account_height (nano::transaction const & transaction_a, nano::block_hash const & hash_a) const
|
||||
{
|
||||
auto block = get (transaction_a, hash_a);
|
||||
return block->sideband ().height;
|
||||
}
|
||||
|
||||
void nano::rocksdb::block_store::block_raw_get (nano::transaction const & transaction, nano::block_hash const & hash, nano::rocksdb_val & value) const
|
||||
{
|
||||
auto status = store.get (transaction, tables::blocks, hash, value);
|
||||
|
|
|
@ -31,8 +31,6 @@ namespace rocksdb
|
|||
nano::store_iterator<nano::block_hash, nano::block_w_sideband> begin (nano::transaction const & transaction_a, nano::block_hash const & hash_a) const override;
|
||||
nano::store_iterator<nano::block_hash, nano::block_w_sideband> end () const override;
|
||||
void for_each_par (std::function<void (nano::read_transaction const &, nano::store_iterator<nano::block_hash, block_w_sideband>, nano::store_iterator<nano::block_hash, block_w_sideband>)> const & action_a) const override;
|
||||
// Converts a block hash to a block height
|
||||
uint64_t account_height (nano::transaction const & transaction_a, nano::block_hash const & hash_a) const override;
|
||||
|
||||
protected:
|
||||
void block_raw_get (nano::transaction const & transaction_a, nano::block_hash const & hash_a, nano::rocksdb_val & value) const;
|
||||
|
|
|
@ -1025,7 +1025,7 @@ bool nano::ledger::rollback (nano::write_transaction const & transaction_a, nano
|
|||
{
|
||||
debug_assert (store.block.exists (transaction_a, block_a));
|
||||
auto account_l (account (transaction_a, block_a));
|
||||
auto block_account_height (store.block.account_height (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))
|
||||
|
@ -1633,6 +1633,12 @@ nano::epoch nano::ledger::version (nano::transaction const & transaction, nano::
|
|||
return version (*block);
|
||||
}
|
||||
|
||||
uint64_t nano::ledger::height (nano::transaction const & transaction, nano::block_hash const & hash) const
|
||||
{
|
||||
auto block = store.block.get (transaction, hash);
|
||||
return block->sideband ().height;
|
||||
}
|
||||
|
||||
nano::uncemented_info::uncemented_info (nano::block_hash const & cemented_frontier, nano::block_hash const & frontier, nano::account const & account) :
|
||||
cemented_frontier (cemented_frontier), frontier (frontier), account (account)
|
||||
{
|
||||
|
|
|
@ -89,6 +89,7 @@ public:
|
|||
bool bootstrap_weight_reached () const;
|
||||
static nano::epoch version (nano::block const & block);
|
||||
nano::epoch version (nano::transaction const & transaction, nano::block_hash const & hash) const;
|
||||
uint64_t height (nano::transaction const & transaction, nano::block_hash const & hash) const;
|
||||
static nano::uint128_t const unit;
|
||||
nano::ledger_constants & constants;
|
||||
nano::store & store;
|
||||
|
|
|
@ -756,7 +756,6 @@ public:
|
|||
virtual nano::store_iterator<nano::block_hash, block_w_sideband> begin (nano::transaction const &) const = 0;
|
||||
virtual nano::store_iterator<nano::block_hash, block_w_sideband> end () const = 0;
|
||||
virtual void for_each_par (std::function<void (nano::read_transaction const &, nano::store_iterator<nano::block_hash, block_w_sideband>, nano::store_iterator<nano::block_hash, block_w_sideband>)> const & action_a) const = 0;
|
||||
virtual uint64_t account_height (nano::transaction const & transaction_a, nano::block_hash const & hash_a) const = 0;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue