CatapultServer  v0.5.0.1 (Elephant)
AccountState.h
Go to the documentation of this file.
1 
21 #pragma once
22 #include "AccountActivityBuckets.h"
23 #include "AccountBalances.h"
25 
26 namespace catapult { namespace state {
27 
29  enum class AccountType : uint8_t {
31  Unlinked,
32 
34  Main,
35 
37  Remote,
38 
41  };
42 
44  struct AccountState {
45  public:
47  explicit AccountState(const catapult::Address& address, Height addressHeight)
48  : Address(address)
49  , AddressHeight(addressHeight)
50  , PublicKey()
51  , PublicKeyHeight(0)
54  {}
55 
56  public:
59 
62 
65 
68 
71 
74 
77 
80 
83  };
84 
86  bool IsRemote(AccountType accountType);
87 
89  void RequireLinkedRemoteAndMainAccounts(const AccountState& remoteAccountState, const AccountState& mainAccountState);
90 }}
catapult::state::AccountState::PublicKey
Key PublicKey
Public key of an account. Present if PublicKeyHeight > 0.
Definition: AccountState.h:64
catapult::state::AccountType::Remote
Account is a remote harvester account that is linked to a balance-holding account.
catapult::state::IsRemote
bool IsRemote(AccountType accountType)
Returns true if accountType corresponds to a remote account.
Definition: AccountState.cpp:41
catapult::state::AccountBalances
Container holding information about account.
Definition: AccountBalances.h:31
catapult::state::AccountState
Account state data.
Definition: AccountState.h:44
catapult::state::AccountActivityBuckets
Stack of account activity buckets.
Definition: AccountActivityBuckets.h:29
catapult::state::AccountState::PublicKeyHeight
Height PublicKeyHeight
Height at which public key has been obtained.
Definition: AccountState.h:67
catapult::state::AccountState::AccountType
state::AccountType AccountType
Type of account.
Definition: AccountState.h:70
catapult::state::AccountState::ActivityBuckets
AccountActivityBuckets ActivityBuckets
Activity buckets of the account.
Definition: AccountState.h:79
catapult::state::AccountType
AccountType
Possible account types.
Definition: AccountState.h:29
catapult::state::AccountType::Unlinked
Account is not linked to another account.
catapult::utils::BaseValue< uint64_t, Height_tag >
AccountImportanceSnapshots.h
catapult::state::AccountState::Address
catapult::Address Address
Address of an account.
Definition: AccountState.h:58
catapult::state::AccountState::LinkedAccountKey
Key LinkedAccountKey
Public key of linked account.
Definition: AccountState.h:73
Address.h
catapult::state::AccountImportanceSnapshots
Stack of account importance snapshots.
Definition: AccountImportanceSnapshots.h:28
catapult::model::AddressToString
std::string AddressToString(const Address &address)
Creates an encoded address from an address.
Definition: Address.cpp:38
AccountActivityBuckets.h
AccountState.h
CATAPULT_THROW_RUNTIME_ERROR
#define CATAPULT_THROW_RUNTIME_ERROR(MESSAGE)
Macro used to throw a catapult runtime error.
Definition: exceptions.h:167
catapult::state::RequireLinkedRemoteAndMainAccounts
void RequireLinkedRemoteAndMainAccounts(const AccountState &remoteAccountState, const AccountState &mainAccountState)
Requires that remoteAccountState and mainAccountState state are linked.
Definition: AccountState.cpp:52
catapult::state::AccountType::Remote_Unlinked
Account is a remote harvester eligible account that is unlinked.
catapult::state::AccountState::Balances
AccountBalances Balances
Balances of an account.
Definition: AccountState.h:82
catapult
Definition: AddressExtractionExtension.cpp:28
catapult::state::AccountType::Main
Account is a balance-holding account that is linked to a remote harvester account.
AccountBalances.h
catapult::utils::ByteArray< Address_Decoded_Size, Address_tag >
catapult::state::AccountState::AddressHeight
Height AddressHeight
Height at which address has been obtained.
Definition: AccountState.h:61
catapult::state::AccountState::ImportanceSnapshots
AccountImportanceSnapshots ImportanceSnapshots
Importance snapshots of the account.
Definition: AccountState.h:76
catapult::state::AccountState::AccountState
AccountState(const catapult::Address &address, Height addressHeight)
Creates an account state from an address and a height (addressHeight).
Definition: AccountState.h:47