Line data Source code
1 : /**
2 : * Copyright Soramitsu Co., Ltd. All Rights Reserved.
3 : * SPDX-License-Identifier: Apache-2.0
4 : */
5 :
6 : #include "main/impl/block_loader_init.hpp"
7 : #include "validators/default_validator.hpp"
8 :
9 : using namespace iroha;
10 : using namespace iroha::ametsuchi;
11 : using namespace iroha::network;
12 :
13 : auto BlockLoaderInit::createService(
14 : std::shared_ptr<BlockQueryFactory> block_query_factory,
15 : std::shared_ptr<consensus::ConsensusResultCache> consensus_result_cache) {
16 0 : return std::make_shared<BlockLoaderService>(
17 0 : std::move(block_query_factory), std::move(consensus_result_cache));
18 : }
19 :
20 : auto BlockLoaderInit::createLoader(
21 : std::shared_ptr<PeerQueryFactory> peer_query_factory) {
22 0 : shared_model::proto::ProtoBlockFactory factory(
23 0 : std::make_unique<
24 : shared_model::validation::DefaultSignedBlockValidator>());
25 0 : return std::make_shared<BlockLoaderImpl>(std::move(peer_query_factory),
26 0 : std::move(factory));
27 0 : }
28 :
29 : std::shared_ptr<BlockLoader> BlockLoaderInit::initBlockLoader(
30 : std::shared_ptr<PeerQueryFactory> peer_query_factory,
31 : std::shared_ptr<BlockQueryFactory> block_query_factory,
32 : std::shared_ptr<consensus::ConsensusResultCache> consensus_result_cache) {
33 0 : service = createService(std::move(block_query_factory),
34 0 : std::move(consensus_result_cache));
35 0 : loader = createLoader(std::move(peer_query_factory));
36 0 : return loader;
37 0 : }
|