CatapultServer  v0.5.0.1 (Elephant)
BlockDifficultyScorer.h
Go to the documentation of this file.
1 
21 #pragma once
24 #include "catapult/types.h"
25 
26 namespace catapult { namespace chain {
27 
30  Difficulty CalculateDifficulty(const cache::DifficultyInfoRange& difficultyInfos, const model::BlockChainConfiguration& config);
31 
34  Difficulty CalculateDifficulty(const cache::BlockDifficultyCache& cache, Height height, const model::BlockChainConfiguration& config);
35 
39  const cache::BlockDifficultyCache& cache,
40  Height height,
41  const model::BlockChainConfiguration& config,
42  Difficulty& difficulty);
43 }}
BlockDifficultyScorer.h
catapult::model::BlockChainConfiguration
Block chain configuration settings.
Definition: BlockChainConfiguration.h:33
BlockChainConfiguration.h
BlockDifficultyCache.h
BlockDifficultyInfo.h
catapult::chain::CalculateDifficulty
Difficulty CalculateDifficulty(const cache::DifficultyInfoRange &difficultyInfos, const model::BlockChainConfiguration &config)
Definition: BlockDifficultyScorer.cpp:26
catapult::utils::BasicBaseValue::ValueType
TValue ValueType
Raw value type.
Definition: BaseValue.h:33
catapult::cache::SynchronizedCache::createView
LockedCacheView< CacheViewType > createView() const
Returns a locked cache view based on this cache.
Definition: SynchronizedCache.h:218
catapult::Height
utils::BaseValue< uint64_t, Height_tag > Height
Definition: src/catapult/types.h:85
catapult::observers::DEFINE_OBSERVER
DEFINE_OBSERVER(AccountAddress, model::AccountAddressNotification, [](const auto &notification, const auto &context) { DefaultAccountVisitor visitor(context);visitor.visit(notification.Address);})
catapult::state::BlockDifficultyInfo
Definition: BlockDifficultyInfo.h:28
catapult::utils::BasicBaseValue::unwrap
constexpr ValueType unwrap() const
Unwraps this value and returns the underlying raw value.
Definition: BaseValue.h:53
catapult::cache::DifficultyInfoRange
A range of block difficulty infos.
Definition: BlockDifficultyCacheTypes.h:77
catapult::utils::BaseValue< uint64_t, Height_tag >
catapult::model::BlockChainConfiguration::MaxDifficultyBlocks
uint32_t MaxDifficultyBlocks
Maximum number of blocks to use in a difficulty calculation.
Definition: BlockChainConfiguration.h:70
Observers.h
catapult::model::BlockChainConfiguration::BlockGenerationTargetTime
utils::TimeSpan BlockGenerationTargetTime
Targeted time between blocks.
Definition: BlockChainConfiguration.h:51
catapult::cache::BlockDifficultyCacheView
View on top of the block difficulty cache.
Definition: BlockDifficultyCacheView.h:58
forwardsValidation.info
def info(*args)
Definition: forwardsValidation.py:12
catapult::chain::TryCalculateDifficulty
bool TryCalculateDifficulty(const cache::BlockDifficultyCache &cache, Height height, const model::BlockChainConfiguration &config, Difficulty &difficulty)
Definition: BlockDifficultyScorer.cpp:78
catapult::cache::BasicBlockDifficultyCacheView::difficultyInfos
DifficultyInfoRange difficultyInfos(Height height, size_t count) const
Gets a range object that spans count block difficulty infos starting at the specified height.
Definition: BlockDifficultyCacheView.cpp:42
catapult::utils::TimeSpan::millis
constexpr uint64_t millis() const
Returns the number of milliseconds.
Definition: TimeSpan.h:91
catapult::Difficulty
utils::ClampedBaseValue< uint64_t, Difficulty_tag > Difficulty
Definition: src/catapult/types.h:99
types.h
catapult
Definition: AddressExtractionExtension.cpp:28
catapult::utils::ClampedBaseValue
Base values that are constrained to a range of values.
Definition: ClampedBaseValue.h:27
catapult::cache::BlockDifficultyCache
Synchronized cache composed of block difficulty information.
Definition: BlockDifficultyCache.h:45