Kagome
Polkadot Runtime Engine in C++17
address_publisher.hpp
Go to the documentation of this file.
1 
6 #ifndef KAGOME_ADDRESS_PUBLISHER_IMPL_HPP
7 #define KAGOME_ADDRESS_PUBLISHER_IMPL_HPP
8 
14 #include "log/logger.hpp"
16 
17 #include <libp2p/crypto/key_marshaller.hpp>
18 #include <libp2p/host/host.hpp>
19 #include <libp2p/protocol/kademlia/kademlia.hpp>
20 #include <memory>
21 
28  : public std::enable_shared_from_this<AddressPublisher> {
29  public:
31  std::shared_ptr<runtime::AuthorityDiscoveryApi> authority_discovery_api,
32  network::Roles roles,
33  std::shared_ptr<application::AppStateManager> app_state_manager,
34  std::shared_ptr<blockchain::BlockTree> block_tree,
35  std::shared_ptr<crypto::SessionKeys> keys,
36  const libp2p::crypto::KeyPair &libp2p_key,
37  const libp2p::crypto::marshaller::KeyMarshaller &key_marshaller,
38  std::shared_ptr<crypto::Ed25519Provider> ed_crypto_provider,
39  std::shared_ptr<crypto::Sr25519Provider> sr_crypto_provider,
40  libp2p::Host &host,
41  std::shared_ptr<libp2p::protocol::kademlia::Kademlia> kademlia,
42  std::shared_ptr<libp2p::basic::Scheduler> scheduler);
43 
44  bool start();
45 
46  outcome::result<void> publishOwnAddress();
47 
48  private:
49  std::shared_ptr<runtime::AuthorityDiscoveryApi> authority_discovery_api_;
51  std::shared_ptr<blockchain::BlockTree> block_tree_;
52 
53  std::shared_ptr<crypto::SessionKeys> keys_;
54 
55  std::shared_ptr<crypto::Ed25519Provider> ed_crypto_provider_;
56  std::shared_ptr<crypto::Sr25519Provider> sr_crypto_provider_;
57 
59  std::shared_ptr<libp2p::protocol::kademlia::Kademlia> kademlia_;
60 
61  std::shared_ptr<libp2p::basic::Scheduler> scheduler_;
62 
64 
65  std::optional<crypto::Ed25519Keypair> libp2p_key_;
66  std::optional<libp2p::crypto::ProtobufKey> libp2p_key_pb_;
67  };
68 } // namespace kagome::authority_discovery
69 
70 #endif // KAGOME_ADDRESS_PUBLISHER_IMPL_HPP
std::optional< crypto::Ed25519Keypair > libp2p_key_
std::shared_ptr< blockchain::BlockTree > block_tree_
std::shared_ptr< crypto::Ed25519Provider > ed_crypto_provider_
std::shared_ptr< libp2p::basic::Scheduler > scheduler_
AddressPublisher(std::shared_ptr< runtime::AuthorityDiscoveryApi > authority_discovery_api, network::Roles roles, std::shared_ptr< application::AppStateManager > app_state_manager, std::shared_ptr< blockchain::BlockTree > block_tree, std::shared_ptr< crypto::SessionKeys > keys, const libp2p::crypto::KeyPair &libp2p_key, const libp2p::crypto::marshaller::KeyMarshaller &key_marshaller, std::shared_ptr< crypto::Ed25519Provider > ed_crypto_provider, std::shared_ptr< crypto::Sr25519Provider > sr_crypto_provider, libp2p::Host &host, std::shared_ptr< libp2p::protocol::kademlia::Kademlia > kademlia, std::shared_ptr< libp2p::basic::Scheduler > scheduler)
std::shared_ptr< crypto::SessionKeys > keys_
std::shared_ptr< soralog::Logger > Logger
Definition: logger.hpp:23
std::shared_ptr< libp2p::protocol::kademlia::Kademlia > kademlia_
std::optional< libp2p::crypto::ProtobufKey > libp2p_key_pb_
std::shared_ptr< runtime::AuthorityDiscoveryApi > authority_discovery_api_
std::shared_ptr< crypto::Sr25519Provider > sr_crypto_provider_