Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions include/bitcoin/network/interfaces/interfaces.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,8 @@ using http = publish<http_methods, grouping::positional>;

namespace peer {

using dispatch = publish<peer_dispatch, grouping::positional,
peer_dispatch::all>;
using broadcast = publish<peer_broadcast, grouping::positional,
peer_broadcast::all>;
using dispatch = publish<peer_dispatch, grouping::positional>;
using broadcast = publish<peer_broadcast, grouping::positional>;

} // namespace peer
} // namespace interface
Expand Down
8 changes: 4 additions & 4 deletions include/bitcoin/network/interfaces/peer_broadcast.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ struct peer_broadcast
using signature = std::function<bool(const code&,
const typename Message::cptr&, const key&)>;

/// 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>{},
Expand Down Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions include/bitcoin/network/interfaces/peer_dispatch.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ struct peer_dispatch
using signature = std::function<bool(const code&,
const typename Message::cptr&)>;

/// 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>{},
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion include/bitcoin/network/messages/peer/registry.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<methods_t>;

/// Index of an unregistered command (one past the last valid index).
Expand Down
10 changes: 5 additions & 5 deletions include/bitcoin/network/messages/rpc/publish.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@ namespace rpc {

/// Methods are a std::tuple of rpc::method<name, args>.
/// Defines a published interface for use with rpc::dispatcher<>.
/// Tuple selects the published methods (e.g. a handshake subset).
template <typename Methods, grouping Mode = grouping::either,
const auto& Tuple = Methods::methods>
/// 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 <typename Methods, grouping Mode = grouping::either>
struct publish
: public Methods
{
static constexpr auto& methods = Tuple;
using type = std::remove_cvref_t<decltype(Tuple)>;
using type = decltype(Methods::methods);
static constexpr auto size = std::tuple_size_v<type>;
static constexpr grouping mode = Mode;
};
Expand Down
Loading