CatapultServer  v0.5.0.1 (Elephant)
AggregateBlockChangeSubscriber.h
Go to the documentation of this file.
1 
21 #pragma once
24 
25 namespace catapult { namespace subscribers {
26 
28  template<typename TBlockChangeSubscriber = io::BlockChangeSubscriber>
30  public:
32 
33  public:
34  void notifyBlock(const model::BlockElement& blockElement) override {
35  this->forEach([&blockElement](auto& subscriber) { subscriber.notifyBlock(blockElement); });
36  }
37 
38  void notifyDropBlocksAfter(Height height) override {
39  this->forEach([height](auto& subscriber) { subscriber.notifyDropBlocksAfter(height); });
40  }
41  };
42 }}
catapult::validators::DEFINE_STATEFUL_VALIDATOR
DEFINE_STATEFUL_VALIDATOR(EligibleHarvester, [](const auto &notification, const auto &context) { cache::ImportanceView view(context.Cache.template sub< cache::AccountStateCache >());return view.canHarvest(notification.Signer, context.Height) ? ValidationResult::Success :Failure_Core_Block_Harvester_Ineligible;})
catapult::cache::AccountRestrictionCacheTypes::CacheReadOnlyType
ReadOnlyArtifactCache< BasicAccountRestrictionCacheView, BasicAccountRestrictionCacheDelta, const Address &, state::AccountRestrictions > CacheReadOnlyType
Definition: AccountRestrictionCacheTypes.h:79
catapult::model::IsValidAddress
bool IsValidAddress(const Address &address, NetworkIdentifier networkIdentifier)
Returns a value indicating whether or not the given address is valid for the network identified by ne...
Definition: Address.cpp:70
AccountRestrictionCache.h
catapult::validators::AccountRestrictionView
A view on top of a catapult cache cache for retrieving a typed account restriction.
Definition: AccountRestrictionView.h:31
ValidatorContext.h
catapult::validators::Notification
model::AccountAddressNotification Notification
Definition: AddressValidator.cpp:27
BlockChangeSubscriber.h
MAKE_STATEFUL_VALIDATOR
#define MAKE_STATEFUL_VALIDATOR(NAME, HANDLER)
Definition: ValidatorTypes.h:123
BasicAggregateSubscriber.h
AccountRestrictionView.h
catapult::subscribers::AggregateBlockChangeSubscriber::notifyDropBlocksAfter
void notifyDropBlocksAfter(Height height) override
Indicates all blocks after height were invalidated.
Definition: AggregateBlockChangeSubscriber.h:38
catapult::validators::DECLARE_STATEFUL_VALIDATOR
DECLARE_STATEFUL_VALIDATOR(Address, Notification)(model
Definition: AddressValidator.cpp:29
catapult::io::BlockChangeSubscriber
Block change subscriber.
Definition: BlockChangeSubscriber.h:27
catapult::validators::AccountRestrictionView::initialize
bool initialize(const Address &address)
Tries to initialize the internal iterator for account restriction with address.
Definition: AccountRestrictionView.cpp:30
catapult::utils::BaseValue< uint64_t, Height_tag >
Validators.h
Address.h
catapult::validators::CacheReadOnlyType
typename cache::AccountRestrictionCacheTypes::CacheReadOnlyType CacheReadOnlyType
Definition: AddressInteractionValidator.cpp:30
catapult::subscribers::BasicAggregateSubscriber< TBlockChangeSubscriber >::forEach
void forEach(TAction action) const
Definition: BasicAggregateSubscriber.h:38
catapult::model::PublicKeyToAddress
Address PublicKeyToAddress(const Key &publicKey, NetworkIdentifier networkIdentifier)
Creates an address from a public key (publicKey) for the network identified by networkIdentifier.
Definition: Address.cpp:50
Validators.h
catapult::model::NetworkIdentifier
NetworkIdentifier
Possible network identifiers.
Definition: NetworkInfo.h:45
catapult::subscribers::BasicAggregateSubscriber
Basic aggregate subscriber.
Definition: BasicAggregateSubscriber.h:29
catapult::subscribers::AggregateBlockChangeSubscriber
Aggregate block change subscriber.
Definition: AggregateBlockChangeSubscriber.h:29
catapult::model::BlockElement
Processing element for a block composed of a block and metadata.
Definition: Elements.h:55
catapult::validators::ValidationResult::Success
Validation succeeded.
catapult::validators::AccountRestrictionView::isAllowed
bool isAllowed(model::AccountRestrictionType restrictionType, const TRestrictionValue &value)
Returns true if value is allowed.
Definition: AccountRestrictionView.h:50
catapult::subscribers::AggregateBlockChangeSubscriber::notifyBlock
void notifyBlock(const model::BlockElement &blockElement) override
Indicates blockElement was saved.
Definition: AggregateBlockChangeSubscriber.h:34
catapult
Definition: AddressExtractionExtension.cpp:28
catapult::model::AccountAddressNotification
Notification of use of an account address.
Definition: Notifications.h:57
catapult::utils::ByteArray< Address_Decoded_Size, Address_tag >
catapult::model::AccountRestrictionType::Address
Account restriction type is an address.
catapult::cache::ReadOnlyCatapultCache
A read-only overlay on top of a catapult cache.
Definition: ReadOnlyCatapultCache.h:27