CatapultServer
v0.5.0.1 (Elephant)
|
Classes | |
class | AggregateCosignersNotificationPublisher |
An aggregate notification publisher that only publishes cosigner-related notifications. More... | |
struct | BlockExecutionContext |
Block execution context. More... | |
struct | BlockHitContext |
Contextual information for calculating a block hit. More... | |
class | BlockHitPredicate |
Predicate used to determine if a block is a hit or not. More... | |
struct | ChainSynchronizerConfiguration |
Configuration for customizing a chain synchronizer. More... | |
struct | CheckEligibilityResult |
struct | CompareChainsOptions |
Options for comparing two chains. More... | |
struct | CompareChainsResult |
Result of a chain comparison operation. More... | |
class | EntitiesSynchronizer |
An entities synchronizer. More... | |
struct | ExecutionConfiguration |
Configuration for executing entities. More... | |
class | ProcessingNotificationSubscriber |
A notification subscriber that processes notifications. More... | |
class | ProcessingUndoNotificationSubscriber |
A notification subscriber that captures notifications and allows them to be undone. More... | |
class | PtUpdater |
Provides updating of a partial transactions cache. More... | |
class | PtValidator |
class | RemoteApiForwarder |
Simplifies interacting with remote nodes via apis. More... | |
struct | StaleTransactionInfo |
struct | TransactionUpdateResult |
Result of a transaction update. More... | |
class | UtUpdater |
Provides batch updating of an unconfirmed transactions cache. More... | |
Typedefs | |
using | BatchEntityProcessor = std::function< validators::ValidationResult(Height, Timestamp, const model::WeakEntityInfos &, observers::ObserverState &)> |
using | BlockTarget = boost::multiprecision::uint256_t |
using | FailedTransactionSink = consumer< const model::Transaction &, const Hash256 &, validators::ValidationResult > |
Indicates a transaction with the specified hash failed validation. More... | |
using | KnownHashPredicate = predicate< Timestamp, const Hash256 & > |
Predicate for determining if a hash is known. More... | |
using | TimeSupplier = supplier< Timestamp > |
Supplies a timestamp. More... | |
using | BlockRangeConsumerFunc = consumer< model::BlockRange && > |
Function signature for delivering a block range to a consumer. More... | |
using | CompletionAwareBlockRangeConsumerFunc = std::function< disruptor::DisruptorElementId(model::AnnotatedBlockRange &&, const disruptor::ProcessingCompleteFunc &)> |
Function signature for delivering a block range to a consumer with an additional completion handler. More... | |
template<typename TRemoteApi > | |
using | RemoteNodeSynchronizer = std::function< thread::future< ionet::NodeInteractionResultCode >(const TRemoteApi &)> |
Function signature for synchronizing with a remote node. More... | |
using | ShortHashesSupplier = supplier< model::ShortHashRange > |
Function signature for supplying a range of short hashes. More... | |
Enumerations | |
enum | CosignatureUpdateResult { CosignatureUpdateResult::Error, CosignatureUpdateResult::Ineligible, CosignatureUpdateResult::Unverifiable, CosignatureUpdateResult::Redundant, CosignatureUpdateResult::Added_Incomplete, CosignatureUpdateResult::Added_Complete } |
Result of a cosignature update. More... | |
enum | CosignersValidationResult { CosignersValidationResult::Missing, CosignersValidationResult::Ineligible, CosignersValidationResult::Success, CosignersValidationResult::Failure } |
Result of a partial transaction cosigners validation. More... | |
enum | ChainComparisonCode : uint32_t { ChainComparisonCode::CHAIN_COMPARISON_CODE_LIST } |
Possible chain comparison end states. More... | |
Functions | |
std::unique_ptr< const stateless::NotificationValidator > | CreateJointValidator (const cache::CatapultCache &cache, const TimeSupplier &timeSupplier, const plugins::PluginManager &pluginManager, const ValidationResultPredicate &isSuppressedFailure) |
RemoteNodeSynchronizer< api::RemotePtApi > | CreatePtSynchronizer (const partialtransaction::ShortHashPairsSupplier &shortHashPairsSupplier, const partialtransaction::CosignedTransactionInfosConsumer &transactionInfosConsumer) |
std::unique_ptr< PtValidator > | CreatePtValidator (const cache::CatapultCache &cache, const TimeSupplier &timeSupplier, const plugins::PluginManager &pluginManager) |
Creates a default partial transaction validator around cache, current time supplier (timeSupplier) and pluginManager. More... | |
BatchEntityProcessor | CreateBatchEntityProcessor (const ExecutionConfiguration &config) |
Creates a batch entity processor around config. More... | |
Difficulty | CalculateDifficulty (const cache::DifficultyInfoRange &difficultyInfos, const model::BlockChainConfiguration &config) |
Difficulty | CalculateDifficulty (const cache::BlockDifficultyCache &cache, Height height, const model::BlockChainConfiguration &config) |
bool | TryCalculateDifficulty (const cache::BlockDifficultyCache &cache, Height height, const model::BlockChainConfiguration &config, Difficulty &difficulty) |
void | ExecuteBlock (const model::BlockElement &blockElement, const BlockExecutionContext &executionContext) |
Executes blockElement using the specified execution context (executionContext). More... | |
void | RollbackBlock (const model::BlockElement &blockElement, const BlockExecutionContext &executionContext) |
Rollbacks blockElement using the specified execution context (executionContext). More... | |
uint64_t | CalculateHit (const GenerationHash &generationHash) |
Calculates the hit for a generationHash. More... | |
uint64_t | CalculateScore (const model::Block &parentBlock, const model::Block ¤tBlock) |
Calculates the score of currentBlock with parent parentBlock. More... | |
BlockTarget | CalculateTarget (const utils::TimeSpan &timeSpan, Difficulty difficulty, Importance signerImportance, const model::BlockChainConfiguration &config) |
BlockTarget | CalculateTarget (const model::Block &parentBlock, const model::Block ¤tBlock, Importance signerImportance, const model::BlockChainConfiguration &config) |
bool | IsRemoteOutOfSync (ChainComparisonCode code) |
Gets a value indicating whether or not code indicates that the remote node is out of sync. More... | |
bool | IsRemoteEvil (ChainComparisonCode code) |
Gets a value indicating whether or not code indicates that the remote node is evil. More... | |
std::ostream & | operator<< (std::ostream &out, ChainComparisonCode value) |
Insertion operator for outputting value to out. More... | |
DEFINE_CHAIN_RESULT (Unlinked, 1) | |
Validation failed because a block was received that did not link with the existing chain. More... | |
DEFINE_CHAIN_RESULT (Block_Not_Hit, 2) | |
Validation failed because a block was received that is not a hit. More... | |
DEFINE_CHAIN_RESULT (Block_Inconsistent_State_Hash, 3) | |
Validation failed because a block was received that has an inconsistent state hash. More... | |
DEFINE_CHAIN_RESULT (Block_Inconsistent_Receipts_Hash, 4) | |
Validation failed because a block was received that has an inconsistent receipts hash. More... | |
DEFINE_CHAIN_RESULT (Unconfirmed_Cache_Too_Full, 5) | |
Validation failed because the unconfirmed cache is too full. More... | |
RemoteNodeSynchronizer< api::RemoteChainApi > | CreateChainSynchronizer (const std::shared_ptr< const api::ChainApi > &pLocalChainApi, const ChainSynchronizerConfiguration &config, const CompletionAwareBlockRangeConsumerFunc &blockRangeConsumer) |
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. More... | |
size_t | CheckDifficulties (const cache::BlockDifficultyCache &cache, const std::vector< const model::Block * > &blocks, const model::BlockChainConfiguration &config) |
model::ChainScore | CalculatePartialChainScore (const model::Block &parent, const std::vector< const model::Block * > &blocks) |
Calculates the partial chain score of blocks starting at parent. More... | |
uint32_t | CalculateMaxHashesToAnalyze (const CompareChainsOptions &options) |
Returns max number of hashes to analyze. More... | |
thread::future< CompareChainsResult > | CompareChains (const api::ChainApi &local, const api::ChainApi &remote, const CompareChainsOptions &options) |
Compares two chains (local and remote) with the specified options. More... | |
template<typename TSynchronizer > | |
RemoteNodeSynchronizer< typename TSynchronizer::RemoteApiType > | CreateRemoteNodeSynchronizer (const std::shared_ptr< TSynchronizer > &pSynchronizer) |
Creates a remote node synchronizer around pSynchronizer. More... | |
RemoteNodeSynchronizer< api::RemoteTransactionApi > | CreateUtSynchronizer (BlockFeeMultiplier minFeeMultiplier, const ShortHashesSupplier &shortHashesSupplier, const handlers::TransactionRangeHandler &transactionRangeConsumer) |
Variables | |
constexpr uint32_t | Remote_Is_Out_Of_Sync_Flag = 0x40000000 |
Chain comparison code flag that is set if the code indicates an out of sync remote node. More... | |
constexpr uint32_t | Remote_Is_Evil_Flag = 0x80000000 |
Chain comparison code flag that is set if the code indicates an evil remote node. More... | |
using catapult::chain::BatchEntityProcessor = typedef std::function<validators::ValidationResult ( Height, Timestamp, const model::WeakEntityInfos&, observers::ObserverState&)> |
Function signature for validating and executing a batch of entity infos with a shared height and time and updating stateful information.
using catapult::chain::BlockRangeConsumerFunc = typedef consumer<model::BlockRange&&> |
Function signature for delivering a block range to a consumer.
using catapult::chain::BlockTarget = typedef boost::multiprecision::uint256_t |
using catapult::chain::CompletionAwareBlockRangeConsumerFunc = typedef std::function<disruptor::DisruptorElementId ( model::AnnotatedBlockRange&&, const disruptor::ProcessingCompleteFunc&)> |
Function signature for delivering a block range to a consumer with an additional completion handler.
using catapult::chain::FailedTransactionSink = typedef consumer<const model::Transaction&, const Hash256&, validators::ValidationResult> |
Indicates a transaction with the specified hash failed validation.
using catapult::chain::KnownHashPredicate = typedef predicate<Timestamp, const Hash256&> |
Predicate for determining if a hash is known.
using catapult::chain::RemoteNodeSynchronizer = typedef std::function<thread::future<ionet::NodeInteractionResultCode> (const TRemoteApi&)> |
Function signature for synchronizing with a remote node.
using catapult::chain::ShortHashesSupplier = typedef supplier<model::ShortHashRange> |
Function signature for supplying a range of short hashes.
using catapult::chain::TimeSupplier = typedef supplier<Timestamp> |
Supplies a timestamp.
|
strong |
|
strong |
Result of a cosignature update.
|
strong |
Difficulty catapult::chain::CalculateDifficulty | ( | const cache::BlockDifficultyCache & | cache, |
Height | height, | ||
const model::BlockChainConfiguration & | config | ||
) |
Calculates the block difficulty at height for the block chain described by config given the block difficulty cache.
Difficulty catapult::chain::CalculateDifficulty | ( | const cache::DifficultyInfoRange & | difficultyInfos, |
const model::BlockChainConfiguration & | config | ||
) |
Calculates the block difficulty given the past difficulties and timestamps (difficultyInfos) for the block chain described by config.
uint64_t catapult::chain::CalculateHit | ( | const GenerationHash & | generationHash | ) |
Calculates the hit for a generationHash.
uint32_t catapult::chain::CalculateMaxHashesToAnalyze | ( | const CompareChainsOptions & | options | ) |
Returns max number of hashes to analyze.
model::ChainScore catapult::chain::CalculatePartialChainScore | ( | const model::Block & | parent, |
const std::vector< const model::Block * > & | blocks | ||
) |
Calculates the partial chain score of blocks starting at parent.
uint64_t catapult::chain::CalculateScore | ( | const model::Block & | parentBlock, |
const model::Block & | currentBlock | ||
) |
Calculates the score of currentBlock with parent parentBlock.
BlockTarget catapult::chain::CalculateTarget | ( | const model::Block & | parentBlock, |
const model::Block & | currentBlock, | ||
Importance | signerImportance, | ||
const model::BlockChainConfiguration & | config | ||
) |
Calculates the target of currentBlock with parent parentBlock and effective signer importance of signerImportance for the block chain described by config.
BlockTarget catapult::chain::CalculateTarget | ( | const utils::TimeSpan & | timeSpan, |
Difficulty | difficulty, | ||
Importance | signerImportance, | ||
const model::BlockChainConfiguration & | config | ||
) |
Calculates the target from a time span (timeSpan), a difficulty and an effective signer importance of signerImportance for the block chain described by config.
size_t catapult::chain::CheckDifficulties | ( | const cache::BlockDifficultyCache & | cache, |
const std::vector< const model::Block * > & | blocks, | ||
const model::BlockChainConfiguration & | config | ||
) |
Checks if the difficulties in blocks are consistent with the difficulties stored in cache for the block chain described by config. If there is an inconsistency, the index of the first difference is returned. Otherwise, the size of blocks is returned.
thread::future< CompareChainsResult > catapult::chain::CompareChains | ( | const api::ChainApi & | local, |
const api::ChainApi & | remote, | ||
const CompareChainsOptions & | options | ||
) |
Compares two chains (local and remote) with the specified options.
BatchEntityProcessor catapult::chain::CreateBatchEntityProcessor | ( | const ExecutionConfiguration & | config | ) |
Creates a batch entity processor around config.
RemoteNodeSynchronizer< api::RemoteChainApi > catapult::chain::CreateChainSynchronizer | ( | const std::shared_ptr< const api::ChainApi > & | pLocalChainApi, |
const ChainSynchronizerConfiguration & | config, | ||
const CompletionAwareBlockRangeConsumerFunc & | blockRangeConsumer | ||
) |
Creates a chain synchronizer around the specified local chain api (pLocalChainApi), a block chain config and a block range consumer (blockRangeConsumer).
std::unique_ptr< const validators::stateless::NotificationValidator > catapult::chain::CreateJointValidator | ( | const cache::CatapultCache & | cache, |
const TimeSupplier & | timeSupplier, | ||
const plugins::PluginManager & | pluginManager, | ||
const validators::ValidationResultPredicate & | isSuppressedFailure | ||
) |
Creates a joint validator around cache and current time supplier (timeSupplier) using pluginManager that ignores suppressed failures according to isSuppressedFailure.
RemoteNodeSynchronizer< api::RemotePtApi > catapult::chain::CreatePtSynchronizer | ( | const partialtransaction::ShortHashPairsSupplier & | shortHashPairsSupplier, |
const partialtransaction::CosignedTransactionInfosConsumer & | transactionInfosConsumer | ||
) |
Creates a partial transactions synchronizer around the specified short hash pairs supplier (shortHashPairsSupplier) and partial transaction infos consumer (transactionInfosConsumer).
std::unique_ptr< PtValidator > catapult::chain::CreatePtValidator | ( | const cache::CatapultCache & | cache, |
const TimeSupplier & | timeSupplier, | ||
const plugins::PluginManager & | pluginManager | ||
) |
Creates a default partial transaction validator around cache, current time supplier (timeSupplier) and pluginManager.
RemoteNodeSynchronizer<typename TSynchronizer::RemoteApiType> catapult::chain::CreateRemoteNodeSynchronizer | ( | const std::shared_ptr< TSynchronizer > & | pSynchronizer | ) |
Creates a remote node synchronizer around pSynchronizer.
RemoteNodeSynchronizer< api::RemoteTransactionApi > catapult::chain::CreateUtSynchronizer | ( | BlockFeeMultiplier | minFeeMultiplier, |
const ShortHashesSupplier & | shortHashesSupplier, | ||
const handlers::TransactionRangeHandler & | transactionRangeConsumer | ||
) |
Creates an unconfirmed transactions synchronizer around the specified short hashes supplier (shortHashesSupplier) and transaction range consumer (transactionRangeConsumer) for transactions with fee multipliers at least minFeeMultiplier.
catapult::chain::DEFINE_CHAIN_RESULT | ( | Block_Inconsistent_Receipts_Hash | , |
4 | |||
) |
Validation failed because a block was received that has an inconsistent receipts hash.
catapult::chain::DEFINE_CHAIN_RESULT | ( | Block_Inconsistent_State_Hash | , |
3 | |||
) |
Validation failed because a block was received that has an inconsistent state hash.
catapult::chain::DEFINE_CHAIN_RESULT | ( | Block_Not_Hit | , |
2 | |||
) |
Validation failed because a block was received that is not a hit.
catapult::chain::DEFINE_CHAIN_RESULT | ( | Unconfirmed_Cache_Too_Full | , |
5 | |||
) |
Validation failed because the unconfirmed cache is too full.
catapult::chain::DEFINE_CHAIN_RESULT | ( | Unlinked | , |
1 | |||
) |
Validation failed because a block was received that did not link with the existing chain.
void catapult::chain::ExecuteBlock | ( | const model::BlockElement & | blockElement, |
const BlockExecutionContext & | executionContext | ||
) |
Executes blockElement using the specified execution context (executionContext).
bool catapult::chain::IsChainLink | ( | const model::Block & | parent, |
const Hash256 & | parentHash, | ||
const model::Block & | child | ||
) |
Determines if parent with hash parentHash and child form a chain link.
bool catapult::chain::IsRemoteEvil | ( | ChainComparisonCode | code | ) |
Gets a value indicating whether or not code indicates that the remote node is evil.
bool catapult::chain::IsRemoteOutOfSync | ( | ChainComparisonCode | code | ) |
Gets a value indicating whether or not code indicates that the remote node is out of sync.
std::ostream& catapult::chain::operator<< | ( | std::ostream & | out, |
ChainComparisonCode | value | ||
) |
Insertion operator for outputting value to out.
void catapult::chain::RollbackBlock | ( | const model::BlockElement & | blockElement, |
const BlockExecutionContext & | executionContext | ||
) |
Rollbacks blockElement using the specified execution context (executionContext).
bool catapult::chain::TryCalculateDifficulty | ( | const cache::BlockDifficultyCache & | cache, |
Height | height, | ||
const model::BlockChainConfiguration & | config, | ||
Difficulty & | difficulty | ||
) |
Calculates the block difficulty at height into difficulty for the block chain described by config given the block difficulty cache.
|
constexpr |
Chain comparison code flag that is set if the code indicates an evil remote node.
|
constexpr |
Chain comparison code flag that is set if the code indicates an out of sync remote node.