Line data Source code
1 : /**
2 : * Copyright Soramitsu Co., Ltd. All Rights Reserved.
3 : * SPDX-License-Identifier: Apache-2.0
4 : */
5 :
6 : #include "network/impl/peer_communication_service_impl.hpp"
7 :
8 : #include "interfaces/iroha_internal/transaction_batch.hpp"
9 : #include "logger/logger.hpp"
10 : #include "network/ordering_gate.hpp"
11 : #include "simulator/verified_proposal_creator.hpp"
12 : #include "synchronizer/synchronizer.hpp"
13 :
14 : namespace iroha {
15 : namespace network {
16 : PeerCommunicationServiceImpl::PeerCommunicationServiceImpl(
17 : std::shared_ptr<OrderingGate> ordering_gate,
18 : std::shared_ptr<synchronizer::Synchronizer> synchronizer,
19 : std::shared_ptr<iroha::simulator::VerifiedProposalCreator>
20 : proposal_creator,
21 : logger::LoggerPtr log)
22 247 : : ordering_gate_(std::move(ordering_gate)),
23 247 : synchronizer_(std::move(synchronizer)),
24 247 : proposal_creator_(std::move(proposal_creator)),
25 247 : log_{std::move(log)} {}
26 :
27 : void PeerCommunicationServiceImpl::propagate_batch(
28 : std::shared_ptr<shared_model::interface::TransactionBatch> batch)
29 : const {
30 724 : log_->info("propagate batch");
31 724 : ordering_gate_->propagateBatch(batch);
32 724 : }
33 :
34 : rxcpp::observable<OrderingEvent> PeerCommunicationServiceImpl::onProposal()
35 : const {
36 494 : return ordering_gate_->onProposal();
37 0 : }
38 :
39 : rxcpp::observable<simulator::VerifiedProposalCreatorEvent>
40 : PeerCommunicationServiceImpl::onVerifiedProposal() const {
41 494 : return proposal_creator_->onVerifiedProposal();
42 0 : }
43 :
44 : rxcpp::observable<synchronizer::SynchronizationEvent>
45 : PeerCommunicationServiceImpl::on_commit() const {
46 988 : return synchronizer_->on_commit_chain();
47 0 : }
48 : } // namespace network
49 : } // namespace iroha
|