CatapultServer  v0.5.0.1 (Elephant)
Harvester.h
Go to the documentation of this file.
1 
21 #pragma once
23 #include "UnlockedAccounts.h"
28 
29 namespace catapult { namespace harvesting { struct BlockExecutionHashes; } }
30 
31 namespace catapult { namespace harvesting {
32 
34  class Harvester {
35  public:
38  explicit Harvester(
39  const cache::CatapultCache& cache,
40  const model::BlockChainConfiguration& config,
41  const Key& beneficiary,
42  const UnlockedAccounts& unlockedAccounts,
43  const BlockGenerator& blockGenerator);
44 
45  public:
48  std::unique_ptr<model::Block> harvest(const model::BlockElement& lastBlockElement, Timestamp timestamp);
49 
50  private:
56  };
57 }}
catapult::harvesting::UnlockedAccounts::view
UnlockedAccountsView view() const
Gets a read only view of the unlocked accounts.
Definition: UnlockedAccounts.cpp:86
CATAPULT_LOG
#define CATAPULT_LOG(SEV)
Writes a log entry to the default logger with SEV severity.
Definition: Logging.h:340
catapult::harvesting::Harvester::m_config
const model::BlockChainConfiguration m_config
Definition: Harvester.h:52
catapult::chain::BlockHitPredicate
Predicate used to determine if a block is a hit or not.
Definition: BlockScorer.h:80
catapult::harvesting::Harvester::m_unlockedAccounts
const UnlockedAccounts & m_unlockedAccounts
Definition: Harvester.h:54
catapult::model::CreateBlock
std::unique_ptr< Block > CreateBlock(const PreviousBlockContext &context, NetworkIdentifier networkIdentifier, const Key &signerPublicKey, const Transactions &transactions)
Definition: BlockUtils.cpp:138
catapult::harvesting::Harvester::harvest
std::unique_ptr< model::Block > harvest(const model::BlockElement &lastBlockElement, Timestamp timestamp)
Definition: Harvester.cpp:82
BlockDifficultyScorer.h
catapult::harvesting::Harvester::m_beneficiary
const Key m_beneficiary
Definition: Harvester.h:53
catapult::model::SignBlockHeader
void SignBlockHeader(const crypto::KeyPair &signer, Block &block)
Definition: BlockUtils.cpp:63
Parser.debug
def debug(*args)
Definition: Parser.py:46
catapult::model::BlockChainConfiguration
Block chain configuration settings.
Definition: BlockChainConfiguration.h:33
BlockChainConfiguration.h
catapult::harvesting::Harvester::m_blockGenerator
BlockGenerator m_blockGenerator
Definition: Harvester.h:55
catapult::chain::BlockHitContext::Height
catapult::Height Height
Block height.
Definition: BlockScorer.h:76
catapult::Height
utils::BaseValue< uint64_t, Height_tag > Height
Definition: src/catapult/types.h:85
catapult::chain::BlockHitContext::GenerationHash
catapult::GenerationHash GenerationHash
Generation hash.
Definition: BlockScorer.h:64
UnlockedAccounts.h
catapult::harvesting::Harvester::Harvester
Harvester(const cache::CatapultCache &cache, const model::BlockChainConfiguration &config, const Key &beneficiary, const UnlockedAccounts &unlockedAccounts, const BlockGenerator &blockGenerator)
Definition: Harvester.cpp:69
catapult::model::CalculateGenerationHash
GenerationHash CalculateGenerationHash(const GenerationHash &previousGenerationHash, const Key &publicKey)
Definition: BlockUtils.cpp:50
catapult::chain::BlockHitContext::ElapsedTime
utils::TimeSpan ElapsedTime
Time since the last block.
Definition: BlockScorer.h:67
catapult::harvesting::BlockGenerator
std::function< std::unique_ptr< model::Block >(const model::BlockHeader &, uint32_t)> BlockGenerator
Generates a block from a seed block header given a maximum number of transactions.
Definition: HarvesterBlockGenerator.h:33
catapult::model::BlockChainConfiguration::Network
NetworkInfo Network
Block chain network.
Definition: BlockChainConfiguration.h:36
KeyPair.h
ParentBlock
const model::Block & ParentBlock
Definition: Harvester.cpp:43
Elements.h
catapult::utils::BaseValue< uint64_t, Timestamp_tag >
ParentContext
model::PreviousBlockContext ParentContext
Definition: Harvester.cpp:44
catapult::chain::BlockHitContext::Difficulty
catapult::Difficulty Difficulty
Block difficulty.
Definition: BlockScorer.h:73
BlockTime
utils::TimeSpan BlockTime
Definition: Harvester.cpp:47
catapult::utils::LogLevel::Debug
Level for logging debug events.
catapult::harvesting::UnlockedAccounts
Container of all unlocked (harvesting candidate) accounts.
Definition: UnlockedAccounts.h:120
catapult::crypto::KeyPair
Represents a pair of private key with associated public key.
Definition: KeyPair.h:33
catapult::chain::TryCalculateDifficulty
bool TryCalculateDifficulty(const cache::BlockDifficultyCache &cache, Height height, const model::BlockChainConfiguration &config, Difficulty &difficulty)
Definition: BlockDifficultyScorer.cpp:78
catapult::cache::CatapultCache
Central cache holding all sub caches.
Definition: CatapultCache.h:40
BlockScorer.h
EntityInfo.h
catapult::utils::StackLogger
Simple RAII class that logs scope messages.
Definition: StackLogger.h:29
m_config
HarvestingConfiguration m_config
Definition: HarvestingService.cpp:126
catapult::model::BlockChainConfiguration::MaxTransactionsPerBlock
uint32_t MaxTransactionsPerBlock
Maximum number of transactions per block.
Definition: BlockChainConfiguration.h:97
StackLogger.h
CatapultCache.h
catapult::model::NetworkIdentifier
NetworkIdentifier
Possible network identifiers.
Definition: NetworkInfo.h:45
catapult::cache::AccountStateCache
Synchronized cache composed of stateful account information.
Definition: AccountStateCache.h:72
catapult::model::AccountRestrictionType::Block
Account restriction is interpreted as blocking operation.
catapult::crypto::KeyPair::publicKey
const auto & publicKey() const
Returns a public key of a key pair.
Definition: KeyPair.h:56
catapult::model::BlockElement
Processing element for a block composed of a block and metadata.
Definition: Elements.h:55
catapult::harvesting::Harvester::m_cache
const cache::CatapultCache & m_cache
Definition: Harvester.h:51
catapult::Difficulty
utils::ClampedBaseValue< uint64_t, Difficulty_tag > Difficulty
Definition: src/catapult/types.h:99
Harvester.h
catapult::Timestamp
utils::BaseValue< uint64_t, Timestamp_tag > Timestamp
Definition: src/catapult/types.h:73
catapult::cache::CatapultCache::sub
const TCache & sub() const
Gets a specific sub cache.
Definition: CatapultCache.h:56
catapult
Definition: AddressExtractionExtension.cpp:28
catapult::utils::ClampedBaseValue< uint64_t, Difficulty_tag >
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::cache::BlockDifficultyCache
Synchronized cache composed of block difficulty information.
Definition: BlockDifficultyCache.h:45
HarvesterBlockGenerator.h
catapult::chain::BlockHitContext::Signer
Key Signer
Public key of the block signer.
Definition: BlockScorer.h:70
catapult::chain::BlockHitContext
Contextual information for calculating a block hit.
Definition: BlockScorer.h:56
catapult::Key
utils::ByteArray< Key_Size, Key_tag > Key
Definition: src/catapult/types.h:41
m_cache
const cache::CatapultCache & m_cache
Definition: JointValidator.cpp:84
BlockUtils.h
catapult::harvesting::Harvester
A class that creates new blocks.
Definition: Harvester.h:34
catapult::cache::ImportanceView
A view on top of an account state cache for retrieving importances.
Definition: ImportanceView.h:29
catapult::model::NetworkInfo::Identifier
NetworkIdentifier Identifier
Network identifier.
Definition: NetworkInfo.h:70
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