diff --git a/include/bitcoin/network/interfaces/interfaces.hpp b/include/bitcoin/network/interfaces/interfaces.hpp index c636703fa..0528e83dc 100644 --- a/include/bitcoin/network/interfaces/interfaces.hpp +++ b/include/bitcoin/network/interfaces/interfaces.hpp @@ -32,10 +32,8 @@ using http = publish; namespace peer { -using dispatch = publish; -using broadcast = publish; +using dispatch = publish; +using broadcast = publish; } // namespace peer } // namespace interface diff --git a/include/bitcoin/network/interfaces/peer_broadcast.hpp b/include/bitcoin/network/interfaces/peer_broadcast.hpp index 883a8eac5..0b888bbdd 100644 --- a/include/bitcoin/network/interfaces/peer_broadcast.hpp +++ b/include/bitcoin/network/interfaces/peer_broadcast.hpp @@ -42,8 +42,8 @@ struct peer_broadcast using signature = std::function; - /// Methods (exchanged after the handshake completes). - static constexpr std::tuple methods + /// Messages exchanged after the handshake completes. + static constexpr std::tuple messages { method<"addr", messages::peer::address::cptr, key>{}, method<"alert", messages::peer::alert::cptr, key>{}, @@ -87,8 +87,8 @@ struct peer_broadcast method<"wtxidrelay", messages::peer::witness_tx_id_relay::cptr, key>{} }; - /// All methods (the channel dispatches on the union). - static constexpr auto all = std::tuple_cat(handshake, methods); + /// The channel dispatches on the union (the wire carries both). + static constexpr auto methods = std::tuple_cat(handshake, messages); }; } // namespace rpc diff --git a/include/bitcoin/network/interfaces/peer_dispatch.hpp b/include/bitcoin/network/interfaces/peer_dispatch.hpp index ffea42612..13d209660 100644 --- a/include/bitcoin/network/interfaces/peer_dispatch.hpp +++ b/include/bitcoin/network/interfaces/peer_dispatch.hpp @@ -38,8 +38,8 @@ struct peer_dispatch using signature = std::function; - /// Methods (exchanged after the handshake completes). - static constexpr std::tuple methods + /// Messages exchanged after the handshake completes. + static constexpr std::tuple messages { method<"addr", messages::peer::address::cptr>{}, method<"alert", messages::peer::alert::cptr>{}, @@ -83,8 +83,8 @@ struct peer_dispatch method<"wtxidrelay", messages::peer::witness_tx_id_relay::cptr>{} }; - /// All methods (the channel dispatches on the union). - static constexpr auto all = std::tuple_cat(handshake, methods); + /// The channel dispatches on the union (the wire carries both). + static constexpr auto methods = std::tuple_cat(handshake, messages); }; } // namespace rpc diff --git a/include/bitcoin/network/messages/peer/registry.hpp b/include/bitcoin/network/messages/peer/registry.hpp index b90771b95..fdc58da67 100644 --- a/include/bitcoin/network/messages/peer/registry.hpp +++ b/include/bitcoin/network/messages/peer/registry.hpp @@ -33,7 +33,7 @@ namespace peer { /// The peer message codec, derived from the dispatch interface. struct registry { - using methods_t = decltype(rpc::peer_dispatch::all); + using methods_t = decltype(rpc::peer_dispatch::methods); static constexpr auto size = std::tuple_size_v; /// Index of an unregistered command (one past the last valid index). diff --git a/include/bitcoin/network/messages/rpc/publish.hpp b/include/bitcoin/network/messages/rpc/publish.hpp index 04cb36cd8..cf9a5b272 100644 --- a/include/bitcoin/network/messages/rpc/publish.hpp +++ b/include/bitcoin/network/messages/rpc/publish.hpp @@ -30,14 +30,14 @@ namespace rpc { /// Methods are a std::tuple of rpc::method. /// Defines a published interface for use with rpc::dispatcher<>. -/// Tuple selects the published methods (e.g. a handshake subset). -template +/// A subset (e.g. a handshake) is published by its own methods type, not by +/// selecting a tuple here, as a reference template argument becomes part of +/// the mangled name of every dependent template. +template struct publish : public Methods { - static constexpr auto& methods = Tuple; - using type = std::remove_cvref_t; + using type = decltype(Methods::methods); static constexpr auto size = std::tuple_size_v; static constexpr grouping mode = Mode; };