CatapultServer  v0.5.0.1 (Elephant)
ImportanceView.h
Go to the documentation of this file.
1 
21 #pragma once
22 #include "catapult/types.h"
23 
24 namespace catapult { namespace cache { class ReadOnlyAccountStateCache; } }
25 
26 namespace catapult { namespace cache {
27 
30  public:
32  explicit ImportanceView(const ReadOnlyAccountStateCache& cache);
33 
34  public:
36  bool tryGetAccountImportance(const Key& publicKey, Height height, Importance& importance) const;
37 
39  Importance getAccountImportanceOrDefault(const Key& publicKey, Height height) const;
40 
42  bool canHarvest(const Key& publicKey, Height height) const;
43 
44  private:
46  };
47 }}
catapult::cache::ReadOnlyAccountStateCache::harvestingMosaicId
MosaicId harvestingMosaicId() const
Gets the harvesting mosaic id.
Definition: ReadOnlyAccountStateCache.cpp:53
catapult::state::AccountType::Remote
Account is a remote harvester account that is linked to a balance-holding account.
catapult::Height
utils::BaseValue< uint64_t, Height_tag > Height
Definition: src/catapult/types.h:85
catapult::cache::ImportanceView::tryGetAccountImportance
bool tryGetAccountImportance(const Key &publicKey, Height height, Importance &importance) const
Tries to populate importance with the importance for publicKey at height.
Definition: ImportanceView.cpp:69
catapult::utils::BaseValue< uint64_t, Height_tag >
catapult::cache::ReadOnlyAccountStateCache::minHarvesterBalance
Amount minHarvesterBalance() const
Gets the minimum harvester balance.
Definition: ReadOnlyAccountStateCache.cpp:49
Address.h
catapult::cache::ImportanceView::canHarvest
bool canHarvest(const Key &publicKey, Height height) const
Returns true if publicKey can harvest at height.
Definition: ImportanceView.cpp:81
catapult::model::PublicKeyToAddress
Address PublicKeyToAddress(const Key &publicKey, NetworkIdentifier networkIdentifier)
Creates an address from a public key (publicKey) for the network identified by networkIdentifier.
Definition: Address.cpp:50
catapult::action
std::function< void()> action
An action function.
Definition: functions.h:27
catapult::cache::CacheId::AccountState
AccountStateCache.h
catapult::state::RequireLinkedRemoteAndMainAccounts
void RequireLinkedRemoteAndMainAccounts(const AccountState &remoteAccountState, const AccountState &mainAccountState)
Requires that remoteAccountState and mainAccountState state are linked.
Definition: AccountState.cpp:52
types.h
catapult::cache::ImportanceView::ImportanceView
ImportanceView(const ReadOnlyAccountStateCache &cache)
Creates a view around cache.
Definition: ImportanceView.cpp:66
catapult
Definition: AddressExtractionExtension.cpp:28
catapult::cache::ImportanceView::m_cache
const ReadOnlyAccountStateCache & m_cache
Definition: ImportanceView.h:45
catapult::utils::ByteArray< Key_Size, Key_tag >
ImportanceView.h
catapult::cache::ReadOnlyAccountStateCache
A read-only overlay on top of an account cache.
Definition: ReadOnlyAccountStateCache.h:36
catapult::Key
utils::ByteArray< Key_Size, Key_tag > Key
Definition: src/catapult/types.h:41
catapult::model::ConvertToImportanceHeight
ImportanceHeight ConvertToImportanceHeight(Height height, Height::ValueType grouping)
Definition: ImportanceHeight.cpp:33
m_cache
const cache::CatapultCache & m_cache
Definition: JointValidator.cpp:84
catapult::cache::ImportanceView
A view on top of an account state cache for retrieving importances.
Definition: ImportanceView.h:29
catapult::cache::ImportanceView::getAccountImportanceOrDefault
Importance getAccountImportanceOrDefault(const Key &publicKey, Height height) const
Gets the importance for publicKey at height or a default importance if no importance is set.
Definition: ImportanceView.cpp:76