CatapultServer  v0.5.0.1 (Elephant)
PtValidator.h
Go to the documentation of this file.
1 
21 #pragma once
25 
26 namespace catapult {
27  namespace cache { class CatapultCache; }
28  namespace model {
29  struct Transaction;
30  class WeakCosignedTransactionInfo;
31  }
32  namespace plugins { class PluginManager; }
33 }
34 
35 namespace catapult { namespace chain {
36 
40  Missing,
41 
43  Ineligible,
44 
46  Success,
47 
49  Failure
50  };
51 
54  class PtValidator {
55  public:
56  virtual ~PtValidator() = default;
57 
58  public:
60  template<typename TNormalizedResult>
61  struct Result {
64 
66  TNormalizedResult Normalized;
67  };
68 
69  public:
71  virtual Result<bool> validatePartial(const model::WeakEntityInfoT<model::Transaction>& transactionInfo) const = 0;
72 
75  };
76 
78  std::unique_ptr<PtValidator> CreatePtValidator(
79  const cache::CatapultCache& cache,
80  const TimeSupplier& timeSupplier,
81  const plugins::PluginManager& pluginManager);
82 }}
catapult::chain::PtValidator::validateCosigners
virtual Result< CosignersValidationResult > validateCosigners(const model::WeakCosignedTransactionInfo &transactionInfo) const =0
Validates the cosigners of a partial transaction (transactionInfo).
catapult::chain::CreatePtValidator
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) an...
Definition: PtValidator.cpp:98
catapult::chain::PtValidator::Result::Normalized
TNormalizedResult Normalized
Normalized validation result.
Definition: PtValidator.h:66
m_pCosignersValidator
std::unique_ptr< const stateless::NotificationValidator > m_pCosignersValidator
Definition: PtValidator.cpp:94
catapult::model::WeakCosignedTransactionInfo
Wrapper around a transaction and its cosignatures.
Definition: WeakCosignedTransactionInfo.h:29
m_statelessTransactionValidator
NotificationValidatorAdapter m_statelessTransactionValidator
Definition: PtValidator.cpp:92
WeakCosignedTransactionInfo.h
catapult::validators::IsValidationResultSuccess
constexpr bool IsValidationResultSuccess(ValidationResult result)
Returns a value indicating whether the validation result is a success.
Definition: ValidationResult.h:90
AggregateCosignersNotificationPublisher.h
m_transactionValidator
NotificationValidatorAdapter m_transactionValidator
Definition: PtValidator.cpp:91
catapult::validators::ValidationResult
ValidationResult
Enumeration of all possible validation results.
Definition: ValidationResult.h:51
WeakEntityInfo.h
catapult::validators::ResultSeverity::Success
Validation result is success.
catapult::plugins::PluginManager
A manager for registering plugins.
Definition: PluginManager.h:51
catapult::model::PublicationMode::Custom
Only custom notifications are published.
catapult::model::PublicationMode::Basic
Only basic notifications are published.
catapult::chain::PtValidator::~PtValidator
virtual ~PtValidator()=default
catapult::validators::NotificationValidatorAdapter
Definition: NotificationValidatorAdapter.h:31
NotificationValidatorAdapter.h
m_aggregatePublisher
AggregateCosignersNotificationPublisher m_aggregatePublisher
Definition: PtValidator.cpp:93
catapult::model::WeakEntityInfoT
Wrapper around a strongly typed entity and its associated metadata.
Definition: WeakEntityInfo.h:33
JointValidator.h
catapult::chain::PtValidator
Definition: PtValidator.h:54
catapult::cache::CatapultCache
Central cache holding all sub caches.
Definition: CatapultCache.h:40
catapult::chain::PtValidator::Result::Raw
validators::ValidationResult Raw
Raw validation result.
Definition: PtValidator.h:63
catapult::chain::CosignersValidationResult::Missing
At least one cosigner is missing.
catapult::chain::PtValidator::Result
A validation result.
Definition: PtValidator.h:61
CATAPULT_LOG_LEVEL
#define CATAPULT_LOG_LEVEL(LEVEL)
Writes a log entry to the default logger with LEVEL severity.
Definition: Logging.h:336
ValidationResult.h
catapult::chain::CosignersValidationResult::Success
All cosigners are eligible and sufficient.
catapult::chain::PtValidator::validatePartial
virtual Result< bool > validatePartial(const model::WeakEntityInfoT< model::Transaction > &transactionInfo) const =0
Validates a partial transaction (transactionInfo) excluding ineligible and missing cosigners checks.
catapult::validators::ResultSeverity::Failure
Validation result is failure.
catapult::chain::CosignersValidationResult
CosignersValidationResult
Result of a partial transaction cosigners validation.
Definition: PtValidator.h:38
PtValidator.h
ChainFunctions.h
catapult::chain::TimeSupplier
supplier< Timestamp > TimeSupplier
Supplies a timestamp.
Definition: ChainFunctions.h:39
PluginManager.h
catapult
Definition: AddressExtractionExtension.cpp:28
catapult::chain::CreateJointValidator
std::unique_ptr< const stateless::NotificationValidator > CreateJointValidator(const cache::CatapultCache &cache, const TimeSupplier &timeSupplier, const plugins::PluginManager &pluginManager, const ValidationResultPredicate &isSuppressedFailure)
Definition: JointValidator.cpp:94
catapult::validators
Definition: AddressValidator.cpp:25
catapult::validators::MapToLogLevel
constexpr utils::LogLevel MapToLogLevel(ValidationResult result)
Maps validation result to an appropriate logging level.
Definition: ValidationResult.h:100
catapult::model::BasicEntityType::Transaction
Transaction type.
catapult::model::PublicationMode
PublicationMode
Publication modes.
Definition: NotificationPublisher.h:34
catapult::chain::CosignersValidationResult::Failure
Transaction failed validation and should be rejected.
ValidatingNotificationSubscriber.h
Results.h
catapult::validators::NotificationValidatorAdapter::validate
ValidationResult validate(const model::WeakEntityInfo &entityInfo) const override
Definition: NotificationValidatorAdapter.cpp:38
catapult::chain::CosignatureUpdateResult::Ineligible
Cosignature is ineligible.