hyperledger/iroha
Iroha - A simple, decentralized ledger http://iroha.tech
block_validator.hpp
Go to the documentation of this file.
1 
6 #ifndef IROHA_BLOCK_VALIDATOR_HPP
7 #define IROHA_BLOCK_VALIDATOR_HPP
8 
9 #include <boost/format.hpp>
10 #include "datetime/time.hpp"
14 #include "validators/answer.hpp"
16 
17 namespace shared_model {
18  namespace validation {
19 
23  template <typename FieldValidator, typename TransactionsCollectionValidator>
25  : public ContainerValidator<interface::Block,
26  FieldValidator,
27  TransactionsCollectionValidator>,
28  public AbstractValidator<interface::Block> {
29  public:
30  using ContainerValidator<
39  Answer validate(const interface::Block &block) const override {
40  return ContainerValidator<interface::Block,
41  FieldValidator,
43  validate(block, "Block", [this](auto &reason, const auto &cont) {
44  this->field_validator_.validateHash(reason, cont.prevHash());
45  });
46  }
47  };
48 
49  } // namespace validation
50 } // namespace shared_model
51 
52 #endif // IROHA_BLOCK_VALIDATOR_HPP
Definition: block_validator.hpp:24
Definition: container_validator.hpp:25
Definition: abstract_validator.hpp:16
ContainerValidator(FieldValidator field_validator, TransactionsCollectionValidator transactions_collection_validator)
Definition: container_validator.hpp:38
Definition: block.hpp:15
Answer validate(const interface::Block &block) const override
Definition: block_validator.hpp:39
void validateHash(ReasonsGroupType &reason, const crypto::Hash &hash) const
Definition: field_validator.cpp:369
Definition: field_validator.hpp:33
Definition: command_executor.hpp:12
Definition: answer.hpp:28
Definition: transactions_collection_validator.hpp:22