Skip to content

Commit

Permalink
Adding const to ledger::weight* functions. (#4534)
Browse files Browse the repository at this point in the history
  • Loading branch information
clemahieu authored Apr 4, 2024
1 parent 311bf68 commit a304dd5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions nano/secure/ledger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -981,7 +981,7 @@ std::pair<nano::block_hash, nano::block_hash> nano::ledger::hash_root_random (st
}

// Vote weight of an account
nano::uint128_t nano::ledger::weight (nano::account const & account_a)
nano::uint128_t nano::ledger::weight (nano::account const & account_a) const
{
if (check_bootstrap_weights.load ())
{
Expand All @@ -1001,7 +1001,7 @@ nano::uint128_t nano::ledger::weight (nano::account const & account_a)
return cache.rep_weights.representation_get (account_a);
}

nano::uint128_t nano::ledger::weight_exact (store::transaction const & txn_a, nano::account const & representative_a)
nano::uint128_t nano::ledger::weight_exact (store::transaction const & txn_a, nano::account const & representative_a) const
{
return store.rep_weight.get (txn_a, representative_a);
}
Expand Down
6 changes: 3 additions & 3 deletions nano/secure/ledger.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@ class ledger final
* If the weight is below the cache limit it returns 0.
* During bootstrap it returns the preconfigured bootstrap weights.
*/
nano::uint128_t weight (nano::account const &);
nano::uint128_t weight (nano::account const &) const;
std::optional<nano::block_hash> successor (store::transaction const &, nano::qualified_root const &) const noexcept;
std::optional<nano::block_hash> successor (store::transaction const & transaction, nano::block_hash const & hash) const noexcept;
/* Returns the exact vote weight for the given representative by doing a database lookup */
nano::uint128_t weight_exact (store::transaction const &, nano::account const &);
nano::uint128_t weight_exact (store::transaction const &, nano::account const &) const;
std::shared_ptr<nano::block> forked_block (store::transaction const &, nano::block const &);
std::shared_ptr<nano::block> head_block (store::transaction const &, nano::account const &);
bool block_confirmed (store::transaction const &, nano::block_hash const &) const;
Expand Down Expand Up @@ -105,7 +105,7 @@ class ledger final
nano::stats & stats;
std::unordered_map<nano::account, nano::uint128_t> bootstrap_weights;
uint64_t bootstrap_weight_max_blocks{ 1 };
std::atomic<bool> check_bootstrap_weights;
mutable std::atomic<bool> check_bootstrap_weights;
bool pruning{ false };

private:
Expand Down

0 comments on commit a304dd5

Please sign in to comment.