CatapultServer  v0.5.0.1 (Elephant)
ChainUtils.h
Go to the documentation of this file.
1 
21 #pragma once
22 #include "catapult/model/Block.h"
24 #include <vector>
25 
26 namespace catapult {
27  namespace cache { class BlockDifficultyCache; }
28  namespace model { struct BlockChainConfiguration; }
29 }
30 
31 namespace catapult { namespace chain {
32 
34  bool IsChainLink(const model::Block& parent, const Hash256& parentHash, const model::Block& child);
35 
39  size_t CheckDifficulties(
40  const cache::BlockDifficultyCache& cache,
41  const std::vector<const model::Block*>& blocks,
42  const model::BlockChainConfiguration& config);
43 
45  model::ChainScore CalculatePartialChainScore(const model::Block& parent, const std::vector<const model::Block*>& blocks);
46 }}
Block.h
CATAPULT_LOG
#define CATAPULT_LOG(SEV)
Writes a log entry to the default logger with SEV severity.
Definition: Logging.h:340
BlockDifficultyScorer.h
catapult::Hash256
utils::ByteArray< Hash256_Size, Hash256_tag > Hash256
Definition: src/catapult/types.h:47
catapult::model::BlockChainConfiguration
Block chain configuration settings.
Definition: BlockChainConfiguration.h:33
BlockChainConfiguration.h
BlockDifficultyCache.h
catapult::chain::CalculateDifficulty
Difficulty CalculateDifficulty(const cache::DifficultyInfoRange &difficultyInfos, const model::BlockChainConfiguration &config)
Definition: BlockDifficultyScorer.cpp:26
catapult::cache::SynchronizedCache::createView
LockedCacheView< CacheViewType > createView() const
Returns a locked cache view based on this cache.
Definition: SynchronizedCache.h:218
colorPrint.warning
def warning(*args)
Definition: colorPrint.py:10
catapult::Height
utils::BaseValue< uint64_t, Height_tag > Height
Definition: src/catapult/types.h:85
ChainUtils.h
catapult::model::BlockHeader::PreviousBlockHash
Hash256 PreviousBlockHash
Hash of the previous block.
Definition: Block.h:53
catapult::state::BlockDifficultyInfo
Definition: BlockDifficultyInfo.h:28
catapult::utils::BaseValue< uint64_t, Height_tag >
catapult::model::ChainScore
Definition: ChainScore.h:30
catapult::model::BlockChainConfiguration::MaxDifficultyBlocks
uint32_t MaxDifficultyBlocks
Maximum number of blocks to use in a difficulty calculation.
Definition: BlockChainConfiguration.h:70
catapult::chain::CalculateScore
uint64_t CalculateScore(const model::Block &parentBlock, const model::Block &currentBlock)
Calculates the score of currentBlock with parent parentBlock.
Definition: BlockScorer.cpp:99
catapult::model::BlockHeader::Height
catapult::Height Height
Height of a block.
Definition: Block.h:41
BlockScorer.h
ChainScore.h
catapult::model::Block
Binary layout for a block.
Definition: Block.h:69
catapult::model::BlockHeader::Timestamp
catapult::Timestamp Timestamp
Timestamp of a block.
Definition: Block.h:44
catapult::Difficulty
utils::ClampedBaseValue< uint64_t, Difficulty_tag > Difficulty
Definition: src/catapult/types.h:99
catapult::chain::IsChainLink
bool IsChainLink(const model::Block &parent, const Hash256 &parentHash, const model::Block &child)
Determines if parent with hash parentHash and child form a chain link.
Definition: ChainUtils.cpp:30
catapult::cache::detail::OrderedMemorySetAdapter::MemorySetType
std::set< ElementType > MemorySetType
Definition: CacheDescriptorAdapters.h:118
ChainScore
model::ChainScore ChainScore
Definition: tools/health/main.cpp:43
catapult
Definition: AddressExtractionExtension.cpp:28
catapult::chain::CalculatePartialChainScore
model::ChainScore CalculatePartialChainScore(const model::Block &parent, const std::vector< const model::Block * > &blocks)
Calculates the partial chain score of blocks starting at parent.
Definition: ChainUtils.cpp:90
catapult::utils::ByteArray
Base class for wrappers of byte array types, to provide some type-safety.
Definition: ByteArray.h:29
catapult::cache::BlockDifficultyCache
Synchronized cache composed of block difficulty information.
Definition: BlockDifficultyCache.h:45
BlockUtils.h
catapult::chain::CheckDifficulties
size_t CheckDifficulties(const cache::BlockDifficultyCache &cache, const std::vector< const model::Block * > &blocks, const model::BlockChainConfiguration &config)
Definition: ChainUtils.cpp:57