Skip to content

Commit

Permalink
StreamProtocols are passed to p2p identify (#2220)
Browse files Browse the repository at this point in the history
  • Loading branch information
ErakhtinB authored Oct 23, 2024
1 parent 5794893 commit 100f8b3
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion core/injector/application_injector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,13 @@ namespace {
std::move(kademlia_config));
}

sptr<libp2p::protocol::IdentifyConfig> get_identify_config() {
libp2p::protocol::IdentifyConfig identify_config;
identify_config.protocols = {"/ipfs/id/1.0.0", "/substrate/1.0"};
return std::make_shared<libp2p::protocol::IdentifyConfig>(
std::move(identify_config));
}

template <typename Injector>
sptr<blockchain::BlockTree> get_block_tree(const Injector &injector) {
auto chain_events_engine =
Expand Down Expand Up @@ -890,6 +897,10 @@ namespace {
di::bind<network::FetchAvailableDataProtocol>.template to<network::FetchAvailableDataProtocolImpl>(),
di::bind<network::WarpProtocol>.template to<network::WarpProtocolImpl>(),
di::bind<network::SendDisputeProtocol>.template to<network::SendDisputeProtocolImpl>(),
bind_by_lambda<libp2p::protocol::IdentifyConfig>(
[](const auto &injector) {
return get_identify_config();
}),

// user-defined overrides...
std::forward<decltype(args)>(args)...);
Expand Down Expand Up @@ -923,7 +934,7 @@ namespace kagome::injector {
KagomeNodeInjector::KagomeNodeInjector(
sptr<application::AppConfiguration> app_config)
: pimpl_{std::make_unique<KagomeNodeInjectorImpl>(
makeKagomeNodeInjector(std::move(app_config)))} {}
makeKagomeNodeInjector(std::move(app_config)))} {}

sptr<application::AppConfiguration> KagomeNodeInjector::injectAppConfig() {
return pimpl_->injector_
Expand Down

0 comments on commit 100f8b3

Please sign in to comment.