CatapultServer  v0.5.0.1 (Elephant)
BlockChainConfiguration.h
Go to the documentation of this file.
1 
21 #pragma once
22 #include "NetworkInfo.h"
26 #include "catapult/types.h"
27 #include <unordered_map>
28 #include <stdint.h>
29 
30 namespace catapult { namespace model {
31 
34  public:
37 
40 
43 
46 
49 
52 
58 
62 
65 
68 
71 
74 
77 
80 
83 
86 
89 
92 
95 
98 
100  std::unordered_map<std::string, utils::ConfigurationBag> Plugins;
101 
102  private:
103  BlockChainConfiguration() = default;
104 
105  public:
108 
111  };
112 
115 
118 
121 
124 
127 
129  template<typename T>
130  T LoadPluginConfiguration(const BlockChainConfiguration& config, const std::string& pluginName) {
131  auto iter = config.Plugins.find(pluginName);
132  if (config.Plugins.cend() == iter)
133  CATAPULT_THROW_AND_LOG_1(utils::property_not_found_error, "plugin configuration not found", pluginName);
134 
135  return T::LoadFromBag(iter->second);
136  }
137 }}
LOAD_NETWORK_PROPERTY
#define LOAD_NETWORK_PROPERTY(NAME)
catapult::model::LoadPluginConfiguration
T LoadPluginConfiguration(const BlockChainConfiguration &config, const std::string &pluginName)
Loads plugin configuration for plugin named pluginName from config.
Definition: BlockChainConfiguration.h:130
catapult::utils::VerifyBagSizeLte
void VerifyBagSizeLte(const ConfigurationBag &bag, size_t expectedSize)
Verifies that the number of properties in bag is no greater than expectedSize.
Definition: utils/ConfigurationUtils.cpp:38
catapult::model::BlockChainConfiguration::ShouldEnableVerifiableReceipts
bool ShouldEnableVerifiableReceipts
true if block chain should calculate receipts so that state changes are fully verifiable at each bloc...
Definition: BlockChainConfiguration.h:42
catapult::model::BlockChainConfiguration::Uninitialized
static BlockChainConfiguration Uninitialized()
Creates an uninitialized block chain configuration.
Definition: BlockChainConfiguration.cpp:36
InputUtils.h
catapult::model::CalculateTransactionCacheDuration
utils::TimeSpan CalculateTransactionCacheDuration(const BlockChainConfiguration &config)
Calculates the duration of time that expired transactions should be cached for the block chain descri...
Definition: BlockChainConfiguration.cpp:120
catapult::model::BlockChainConfiguration
Block chain configuration settings.
Definition: BlockChainConfiguration.h:33
BlockChainConfiguration.h
catapult::model::BlockChainConfiguration::BlockTimeSmoothingFactor
uint32_t BlockTimeSmoothingFactor
Definition: BlockChainConfiguration.h:57
catapult::model::BlockChainConfiguration::HarvestBeneficiaryPercentage
uint8_t HarvestBeneficiaryPercentage
Percentage of the harvested fee that is collected by the beneficiary account.
Definition: BlockChainConfiguration.h:91
catapult::consumers::CreateBlockChainCheckConsumer
disruptor::ConstBlockConsumer CreateBlockChainCheckConsumer(uint32_t maxChainSize, const utils::TimeSpan &maxBlockFutureTime, const chain::TimeSupplier &timeSupplier)
Definition: BlockChainCheckConsumer.cpp:91
ChainUtils.h
catapult::model::BlockChainConfiguration::MaxBlockFutureTime
utils::TimeSpan MaxBlockFutureTime
Maximum future time of a block that can be accepted.
Definition: BlockChainConfiguration.h:76
catapult::model::NetworkInfo
Information about a network.
Definition: NetworkInfo.h:54
catapult::model::BlockChainConfiguration::ShouldEnableVerifiableState
bool ShouldEnableVerifiableState
true if block chain should calculate state hashes so that state is fully verifiable at each block.
Definition: BlockChainConfiguration.h:39
catapult::model::GetUnresolvedCurrencyMosaicId
UnresolvedMosaicId GetUnresolvedCurrencyMosaicId(const BlockChainConfiguration &config)
Gets unresolved currency mosaic id from config.
Definition: BlockChainConfiguration.cpp:105
catapult::disruptor::ConstBlockConsumer
DisruptorConsumerT< const BlockElements > ConstBlockConsumer
A const block disruptor consumer function.
Definition: DisruptorConsumer.h:41
catapult::utils::TimeSpan::FromMilliseconds
static constexpr TimeSpan FromMilliseconds(uint64_t milliseconds)
Creates a time span from the given number of milliseconds.
Definition: TimeSpan.h:59
m_maxChainSize
uint32_t m_maxChainSize
Definition: BlockChainCheckConsumer.cpp:85
FileSize.h
catapult::model::BlockChainConfiguration::MinHarvesterBalance
Amount MinHarvesterBalance
Minimum number of harvesting mosaic atomic units needed for an account to be eligible for harvesting.
Definition: BlockChainConfiguration.h:88
BlockConsumers.h
catapult::UnresolvedMosaicId
utils::BaseValue< uint64_t, UnresolvedMosaicId_tag > UnresolvedMosaicId
Definition: src/catapult/types.h:82
catapult::model::BlockChainConfiguration::BlockChainConfiguration
BlockChainConfiguration()=default
catapult::utils::TimeSpan
Represents a time duration.
Definition: TimeSpan.h:30
catapult::utils::ExtractSectionAsBag
ConfigurationBag ExtractSectionAsBag(const ConfigurationBag &bag, const char *section)
Extracts all section properties from bag into a new bag with a single section with a default (empty s...
Definition: utils/ConfigurationUtils.cpp:43
catapult::utils::ConfigurationBag
A simple bag of properties.
Definition: ConfigurationBag.h:57
catapult::model::BlockChainConfiguration::Network
NetworkInfo Network
Block chain network.
Definition: BlockChainConfiguration.h:36
catapult::utils::BasicBaseValue::unwrap
constexpr ValueType unwrap() const
Unwraps this value and returns the underlying raw value.
Definition: BaseValue.h:53
catapult::utils::BaseValue< uint64_t, UnresolvedMosaicId_tag >
catapult::model::BlockChainConfiguration::TotalChainImportance
Importance TotalChainImportance
Total whole importance units available in the network.
Definition: BlockChainConfiguration.h:85
ConsumerResultFactory.h
catapult::model::BlockChainConfiguration::MaxDifficultyBlocks
uint32_t MaxDifficultyBlocks
Maximum number of blocks to use in a difficulty calculation.
Definition: BlockChainConfiguration.h:70
catapult::utils::ConfigurationBag::sections
std::unordered_set< std::string > sections() const
Gets the names of all sections in this bag.
Definition: ConfigurationBag.h:104
catapult::model::BlockChainConfiguration::BlockPruneInterval
uint32_t BlockPruneInterval
Number of blocks between cache pruning.
Definition: BlockChainConfiguration.h:94
NetworkInfo.h
catapult::model::BlockChainConfiguration::BlockGenerationTargetTime
utils::TimeSpan BlockGenerationTargetTime
Targeted time between blocks.
Definition: BlockChainConfiguration.h:51
catapult::model::BlockChainConfiguration::MaxTransactionLifetime
utils::TimeSpan MaxTransactionLifetime
Maximum lifetime a transaction can have before it expires.
Definition: BlockChainConfiguration.h:73
catapult::utils::TimeSpan::FromHours
static constexpr TimeSpan FromHours(uint64_t hours)
Creates a time span from the given number of hours.
Definition: TimeSpan.h:44
catapult::model::BlockChainConfiguration::ImportanceGrouping
uint64_t ImportanceGrouping
Definition: BlockChainConfiguration.h:61
catapult::model::BlockChainConfiguration::CurrencyMosaicId
MosaicId CurrencyMosaicId
Mosaic id used as primary chain currency.
Definition: BlockChainConfiguration.h:45
catapult::model::BlockChainConfiguration::Plugins
std::unordered_map< std::string, utils::ConfigurationBag > Plugins
Unparsed map of plugin configuration.
Definition: BlockChainConfiguration.h:100
m_maxBlockFutureTime
utils::TimeSpan m_maxBlockFutureTime
Definition: BlockChainCheckConsumer.cpp:86
catapult::model::CalculateRollbackVariabilityBufferDuration
utils::TimeSpan CalculateRollbackVariabilityBufferDuration(const BlockChainConfiguration &config)
Calculates the duration of the rollback variability buffer for the block chain described by config.
Definition: BlockChainConfiguration.cpp:113
PublicKey
Key PublicKey
Definition: PacketReaders.cpp:36
CATAPULT_THROW_AND_LOG_1
#define CATAPULT_THROW_AND_LOG_1(TYPE, MESSAGE, PARAM1)
Macro used to throw a catapult exception with one parameter.
Definition: exceptions.h:152
CATAPULT_THROW_INVALID_ARGUMENT_1
#define CATAPULT_THROW_INVALID_ARGUMENT_1(MESSAGE, PARAM1)
Macro used to throw a catapult invalid argument with a single parameter.
Definition: exceptions.h:183
catapult::model::BlockChainConfiguration::MaxTransactionsPerBlock
uint32_t MaxTransactionsPerBlock
Maximum number of transactions per block.
Definition: BlockChainConfiguration.h:97
catapult::consumers::Abort
constexpr disruptor::ConsumerResult Abort(validators::ValidationResult validationResult)
Creates an aborted consumer result around validationResult.
Definition: ConsumerResultFactory.h:34
ConfigurationUtils.h
catapult::model::BlockChainConfiguration::MaxRollbackBlocks
uint32_t MaxRollbackBlocks
Maximum number of blocks that can be rolled back.
Definition: BlockChainConfiguration.h:67
catapult::utils::TimeSpan::millis
constexpr uint64_t millis() const
Returns the number of milliseconds.
Definition: TimeSpan.h:91
catapult::disruptor::BlockElements
std::vector< model::BlockElement > BlockElements
A container of BlockElement.
Definition: DisruptorTypes.h:132
LOAD_CHAIN_PROPERTY
#define LOAD_CHAIN_PROPERTY(NAME)
TimeSpan.h
catapult::model::BlockChainConfiguration::MaxMosaicAtomicUnits
Amount MaxMosaicAtomicUnits
Maximum atomic units (total-supply * 10 ^ divisibility) of a mosaic allowed in the network.
Definition: BlockChainConfiguration.h:82
catapult::utils::property_not_found_error
Exception class that is thrown when a required configuration property is missing.
Definition: ConfigurationBag.h:32
ConfigurationBag.h
catapult::chain::TimeSupplier
supplier< Timestamp > TimeSupplier
Supplies a timestamp.
Definition: ChainFunctions.h:39
types.h
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::model::BlockChainConfiguration::InitialCurrencyAtomicUnits
Amount InitialCurrencyAtomicUnits
Initial currency atomic units available in the network.
Definition: BlockChainConfiguration.h:79
catapult::Timestamp
utils::BaseValue< uint64_t, Timestamp_tag > Timestamp
Definition: src/catapult/types.h:73
catapult
Definition: AddressExtractionExtension.cpp:28
Hashers.h
catapult::model::BlockChainConfiguration::ImportanceActivityPercentage
uint8_t ImportanceActivityPercentage
Percentage of importance resulting from fee generation and beneficiary usage.
Definition: BlockChainConfiguration.h:64
catapult::utils::ByteArray< Hash256_Size, GenerationHash_tag >
catapult::model::CalculateFullRollbackDuration
utils::TimeSpan CalculateFullRollbackDuration(const BlockChainConfiguration &config)
Calculates the duration of a full rollback for the block chain described by config.
Definition: BlockChainConfiguration.cpp:109
catapult::utils::HashPointerSet
ArrayPointerSet< Hash256 > HashPointerSet
A hash pointer set.
Definition: ArraySet.h:70
catapult::model::CalculateDifficultyHistorySize
uint64_t CalculateDifficultyHistorySize(const BlockChainConfiguration &config)
Calculates the number of historical difficulties to cache in memory for the block chain described by ...
Definition: BlockChainConfiguration.cpp:126
catapult::model::BlockChainConfiguration::LoadFromBag
static BlockChainConfiguration LoadFromBag(const utils::ConfigurationBag &bag)
Loads a block chain configuration from bag.
Definition: BlockChainConfiguration.cpp:40
catapult::model::BlockChainConfiguration::HarvestingMosaicId
MosaicId HarvestingMosaicId
Mosaic id used to provide harvesting ability.
Definition: BlockChainConfiguration.h:48
catapult::consumers::Continue
constexpr disruptor::ConsumerResult Continue()
Creates a continuation consumer result.
Definition: ConsumerResultFactory.h:29
m_timeSupplier
chain::TimeSupplier m_timeSupplier
Definition: BlockChainCheckConsumer.cpp:87