Kagome
Polkadot Runtime Engine in C++17
grandpa_transmitter_impl.cpp
Go to the documentation of this file.
1 
7 
8 #include "network/router.hpp"
9 
10 namespace kagome::network {
11 
13  std::shared_ptr<network::Router> router)
14  : router_(std::move(router)) {}
15 
17  GrandpaNeighborMessage &&message) {
18  auto protocol = router_->getGrandpaProtocol();
19  BOOST_ASSERT_MSG(protocol, "Router did not provide grandpa protocol");
20  protocol->neighbor(std::move(message));
21  }
22 
24  const libp2p::peer::PeerId &peer_id, GrandpaVote &&message) {
25  auto protocol = router_->getGrandpaProtocol();
26  BOOST_ASSERT_MSG(protocol, "Router did not provide grandpa protocol");
27  protocol->vote(std::move(message), peer_id);
28  }
29 
31  auto protocol = router_->getGrandpaProtocol();
32  BOOST_ASSERT_MSG(protocol, "Router did not provide grandpa protocol");
33  protocol->vote(std::move(message), std::nullopt);
34  }
35 
37  const libp2p::peer::PeerId &peer_id, FullCommitMessage &&message) {
38  auto protocol = router_->getGrandpaProtocol();
39  BOOST_ASSERT_MSG(protocol, "Router did not provide grandpa protocol");
40  protocol->finalize(std::move(message), peer_id);
41  }
42 
44  auto protocol = router_->getGrandpaProtocol();
45  BOOST_ASSERT_MSG(protocol, "Router did not provide grandpa protocol");
46  protocol->finalize(std::move(message), std::nullopt);
47  }
48 
50  CatchUpRequest &&message) {
51  auto protocol = router_->getGrandpaProtocol();
52  BOOST_ASSERT_MSG(protocol, "Router did not provide grandpa protocol");
53  protocol->catchUpRequest(peer_id, std::move(message));
54  }
55 
57  CatchUpResponse &&message) {
58  auto protocol = router_->getGrandpaProtocol();
59  BOOST_ASSERT_MSG(protocol, "Router did not provide grandpa protocol");
60  protocol->catchUpResponse(peer_id, std::move(message));
61  }
62 
63 } // namespace kagome::network
STL namespace.
void sendCatchUpResponse(const libp2p::peer::PeerId &peer_id, CatchUpResponse &&message) override
void sendCommitMessage(const libp2p::peer::PeerId &peer_id, FullCommitMessage &&message) override
libp2p::peer::PeerId PeerId
void sendNeighborMessage(GrandpaNeighborMessage &&message) override
void sendVoteMessage(const libp2p::peer::PeerId &peer_id, GrandpaVote &&message) override
GrandpaTransmitterImpl(std::shared_ptr< Router > router)
void sendCatchUpRequest(const libp2p::peer::PeerId &peer_id, CatchUpRequest &&message) override