CatapultServer  v0.5.0.1 (Elephant)
BlockChainProcessor.h
Go to the documentation of this file.
1 
21 #pragma once
25 #include <functional>
26 
27 namespace catapult {
28  namespace cache { class ReadOnlyCatapultCache; }
29  namespace chain { struct ObserverState; }
30 }
31 
32 namespace catapult { namespace consumers {
33 
35  class WeakBlockInfo : public model::WeakEntityInfoT<model::Block> {
36  public:
38  constexpr WeakBlockInfo() : m_pGenerationHash(nullptr)
39  {}
40 
42  constexpr explicit WeakBlockInfo(const model::BlockElement& blockElement)
43  : WeakEntityInfoT(blockElement.Block, blockElement.EntityHash)
44  , m_pGenerationHash(&blockElement.GenerationHash)
45  {}
46 
47  public:
49  constexpr const GenerationHash& generationHash() const {
50  return *m_pGenerationHash;
51  }
52 
53  private:
55  };
56 
60  const WeakBlockInfo&,
63 
66 
69 
71  enum class ReceiptValidationMode {
73  Disabled,
74 
76  Enabled
77  };
78 
82  const BlockHitPredicateFactory& blockHitPredicateFactory,
83  const chain::BatchEntityProcessor& batchEntityProcessor,
84  ReceiptValidationMode receiptValidationMode);
85 }}
catapult::consumers::ReceiptValidationMode::Enabled
Enabled, generate and validate receipts.
CATAPULT_LOG
#define CATAPULT_LOG(SEV)
Writes a log entry to the default logger with SEV severity.
Definition: Logging.h:340
InputUtils.h
catapult::Hash256
utils::ByteArray< Hash256_Size, Hash256_tag > Hash256
Definition: src/catapult/types.h:47
Parser.debug
def debug(*args)
Definition: Parser.py:46
catapult::validators::IsValidationResultSuccess
constexpr bool IsValidationResultSuccess(ValidationResult result)
Returns a value indicating whether the validation result is a success.
Definition: ValidationResult.h:90
catapult::consumers::WeakBlockInfo
A tuple composed of a block, a hash and a generation hash.
Definition: BlockChainProcessor.h:35
catapult::predicate
std::function< bool(TArgs...)> predicate
A predicate function.
Definition: functions.h:31
colorPrint.warning
def warning(*args)
Definition: colorPrint.py:10
catapult::Height
utils::BaseValue< uint64_t, Height_tag > Height
Definition: src/catapult/types.h:85
catapult::validators::ValidationResult
ValidationResult
Enumeration of all possible validation results.
Definition: ValidationResult.h:51
ChainUtils.h
WeakEntityInfo.h
catapult::chain::BatchEntityProcessor
std::function< validators::ValidationResult(Height, Timestamp, const model::WeakEntityInfos &, observers::ObserverState &)> BatchEntityProcessor
Definition: BatchEntityProcessor.h:32
catapult::consumers::WeakBlockInfo::m_pGenerationHash
const GenerationHash * m_pGenerationHash
Definition: BlockChainProcessor.h:54
catapult::model::CalculateGenerationHash
GenerationHash CalculateGenerationHash(const GenerationHash &previousGenerationHash, const Key &publicKey)
Definition: BlockUtils.cpp:50
catapult::model::ExtractEntityInfos
void ExtractEntityInfos(const BlockElement &element, WeakEntityInfos &entityInfos)
Extracts all entity infos from element into entityInfos.
Definition: Elements.cpp:88
catapult::consumers::ExtractEntityInfos
void ExtractEntityInfos(const TransactionElements &elements, model::WeakEntityInfos &entityInfos, std::vector< size_t > &entityInfoElementIndexes)
Definition: InputUtils.cpp:45
BlockChainProcessor.h
catapult::model::WeakEntityInfoT< model::Block >::WeakEntityInfoT
constexpr WeakEntityInfoT()
Creates an entity info.
Definition: WeakEntityInfo.h:36
BatchEntityProcessor.h
ChainResults.h
catapult::consumers::ReceiptValidationMode
ReceiptValidationMode
Possible receipt validation modes.
Definition: BlockChainProcessor.h:71
m_blockHitPredicateFactory
BlockHitPredicateFactory m_blockHitPredicateFactory
Definition: BlockChainProcessor.cpp:184
catapult::validators::ResultSeverity::Neutral
Validation result is neither success nor failure.
catapult::model::CalculateMerkleHash
Hash256 CalculateMerkleHash(const BlockStatement &statement)
Calculates the merkle hash for statement.
Definition: BlockStatement.cpp:83
catapult::consumers::CreateBlockChainProcessor
BlockChainProcessor CreateBlockChainProcessor(const BlockHitPredicateFactory &blockHitPredicateFactory, const chain::BatchEntityProcessor &batchEntityProcessor, ReceiptValidationMode receiptValidationMode)
Definition: BlockChainProcessor.cpp:190
catapult::model::WeakEntityInfoT
Wrapper around a strongly typed entity and its associated metadata.
Definition: WeakEntityInfo.h:33
catapult::observers::ObserverState
Block independent mutable state passed to all observers.
Definition: ObserverContext.h:54
CatapultCache.h
catapult::consumers::WeakBlockInfo::WeakBlockInfo
constexpr WeakBlockInfo()
Creates a block info.
Definition: BlockChainProcessor.h:38
catapult::disruptor::BlockElements
std::vector< model::BlockElement > BlockElements
A container of BlockElement.
Definition: DisruptorTypes.h:132
catapult::consumers::ReceiptValidationMode::Disabled
Disabled, skip validation of receipts.
catapult::model::BlockElement
Processing element for a block composed of a block and metadata.
Definition: Elements.h:55
ReadOnlyCatapultCache.h
catapult::consumers::WeakBlockInfo::generationHash
constexpr const GenerationHash & generationHash() const
Gets the generation hash.
Definition: BlockChainProcessor.h:49
catapult::validators::ValidationResult::Success
Validation succeeded.
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::consumers::BlockChainProcessor
std::function< validators::ValidationResult(const WeakBlockInfo &, disruptor::BlockElements &, observers::ObserverState &)> BlockChainProcessor
Definition: BlockChainProcessor.h:62
catapult::consumers::BlockHitPredicateFactory
std::function< BlockHitPredicate(const cache::ReadOnlyCatapultCache &)> BlockHitPredicateFactory
A factory for creating a predicate for determining whether or not two blocks form a hit.
Definition: BlockChainProcessor.h:68
catapult
Definition: AddressExtractionExtension.cpp:28
catapult::GenerationHash
utils::ByteArray< Hash256_Size, GenerationHash_tag > GenerationHash
Definition: src/catapult/types.h:53
catapult::validators
Definition: AddressValidator.cpp:25
catapult::utils::ByteArray< Hash256_Size, GenerationHash_tag >
m_batchEntityProcessor
chain::BatchEntityProcessor m_batchEntityProcessor
Definition: BlockChainProcessor.cpp:185
BlockUtils.h
DisruptorElement.h
catapult::cache::ReadOnlyCatapultCache
A read-only overlay on top of a catapult cache.
Definition: ReadOnlyCatapultCache.h:27
catapult::model::WeakEntityInfos
std::vector< WeakEntityInfo > WeakEntityInfos
A container of weak entity infos.
Definition: WeakEntityInfo.h:144
catapult::consumers::BlockHitPredicate
predicate< const model::Block &, const model::Block &, const GenerationHash & > BlockHitPredicate
A predicate for determining whether or not two blocks form a hit.
Definition: BlockChainProcessor.h:65
m_receiptValidationMode
ReceiptValidationMode m_receiptValidationMode
Definition: BlockChainProcessor.cpp:186
catapult::consumers::WeakBlockInfo::WeakBlockInfo
constexpr WeakBlockInfo(const model::BlockElement &blockElement)
Creates a block info around blockElement.
Definition: BlockChainProcessor.h:42