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: 3 additions & 3 deletions builds/gnu/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -336,8 +336,7 @@ include_bitcoin_network_interfaces_HEADERS = \
${srcdir}/../../include/bitcoin/network/interfaces/http.hpp \
${srcdir}/../../include/bitcoin/network/interfaces/interfaces.hpp \
${srcdir}/../../include/bitcoin/network/interfaces/peer_broadcast.hpp \
${srcdir}/../../include/bitcoin/network/interfaces/peer_dispatch.hpp \
${srcdir}/../../include/bitcoin/network/interfaces/peer_registry.hpp
${srcdir}/../../include/bitcoin/network/interfaces/peer_dispatch.hpp

include_bitcoin_network_logdir = \
${includedir}/bitcoin/network/log
Expand Down Expand Up @@ -385,7 +384,8 @@ include_bitcoin_network_messages_peer_HEADERS = \
${srcdir}/../../include/bitcoin/network/messages/peer/body.hpp \
${srcdir}/../../include/bitcoin/network/messages/peer/heading.hpp \
${srcdir}/../../include/bitcoin/network/messages/peer/message.hpp \
${srcdir}/../../include/bitcoin/network/messages/peer/peer.hpp
${srcdir}/../../include/bitcoin/network/messages/peer/peer.hpp \
${srcdir}/../../include/bitcoin/network/messages/peer/registry.hpp

include_bitcoin_network_messages_peer_detaildir = \
${includedir}/bitcoin/network/messages/peer/detail
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,6 @@
<ClInclude Include="..\..\..\..\include\bitcoin\network\interfaces\interfaces.hpp" />
<ClInclude Include="..\..\..\..\include\bitcoin\network\interfaces\peer_broadcast.hpp" />
<ClInclude Include="..\..\..\..\include\bitcoin\network\interfaces\peer_dispatch.hpp" />
<ClInclude Include="..\..\..\..\include\bitcoin\network\interfaces\peer_registry.hpp" />
<ClInclude Include="..\..\..\..\include\bitcoin\network\log\capture.hpp" />
<ClInclude Include="..\..\..\..\include\bitcoin\network\log\levels.hpp" />
<ClInclude Include="..\..\..\..\include\bitcoin\network\log\log.hpp" />
Expand Down Expand Up @@ -415,6 +414,7 @@
<ClInclude Include="..\..\..\..\include\bitcoin\network\messages\peer\heading.hpp" />
<ClInclude Include="..\..\..\..\include\bitcoin\network\messages\peer\message.hpp" />
<ClInclude Include="..\..\..\..\include\bitcoin\network\messages\peer\peer.hpp" />
<ClInclude Include="..\..\..\..\include\bitcoin\network\messages\peer\registry.hpp" />
<ClInclude Include="..\..\..\..\include\bitcoin\network\messages\rpc\any.hpp" />
<ClInclude Include="..\..\..\..\include\bitcoin\network\messages\rpc\body.hpp" />
<ClInclude Include="..\..\..\..\include\bitcoin\network\messages\rpc\broadcaster.hpp" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -779,9 +779,6 @@
<ClInclude Include="..\..\..\..\include\bitcoin\network\interfaces\peer_dispatch.hpp">
<Filter>include\bitcoin\network\interfaces</Filter>
</ClInclude>
<ClInclude Include="..\..\..\..\include\bitcoin\network\interfaces\peer_registry.hpp">
<Filter>include\bitcoin\network\interfaces</Filter>
</ClInclude>
<ClInclude Include="..\..\..\..\include\bitcoin\network\log\capture.hpp">
<Filter>include\bitcoin\network\log</Filter>
</ClInclude>
Expand Down Expand Up @@ -983,6 +980,9 @@
<ClInclude Include="..\..\..\..\include\bitcoin\network\messages\peer\peer.hpp">
<Filter>include\bitcoin\network\messages\peer</Filter>
</ClInclude>
<ClInclude Include="..\..\..\..\include\bitcoin\network\messages\peer\registry.hpp">
<Filter>include\bitcoin\network\messages\peer</Filter>
</ClInclude>
<ClInclude Include="..\..\..\..\include\bitcoin\network\messages\rpc\any.hpp">
<Filter>include\bitcoin\network\messages\rpc</Filter>
</ClInclude>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,6 @@
<ClInclude Include="..\..\..\..\include\bitcoin\network\interfaces\interfaces.hpp" />
<ClInclude Include="..\..\..\..\include\bitcoin\network\interfaces\peer_broadcast.hpp" />
<ClInclude Include="..\..\..\..\include\bitcoin\network\interfaces\peer_dispatch.hpp" />
<ClInclude Include="..\..\..\..\include\bitcoin\network\interfaces\peer_registry.hpp" />
<ClInclude Include="..\..\..\..\include\bitcoin\network\log\capture.hpp" />
<ClInclude Include="..\..\..\..\include\bitcoin\network\log\levels.hpp" />
<ClInclude Include="..\..\..\..\include\bitcoin\network\log\log.hpp" />
Expand Down Expand Up @@ -415,6 +414,7 @@
<ClInclude Include="..\..\..\..\include\bitcoin\network\messages\peer\heading.hpp" />
<ClInclude Include="..\..\..\..\include\bitcoin\network\messages\peer\message.hpp" />
<ClInclude Include="..\..\..\..\include\bitcoin\network\messages\peer\peer.hpp" />
<ClInclude Include="..\..\..\..\include\bitcoin\network\messages\peer\registry.hpp" />
<ClInclude Include="..\..\..\..\include\bitcoin\network\messages\rpc\any.hpp" />
<ClInclude Include="..\..\..\..\include\bitcoin\network\messages\rpc\body.hpp" />
<ClInclude Include="..\..\..\..\include\bitcoin\network\messages\rpc\broadcaster.hpp" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -779,9 +779,6 @@
<ClInclude Include="..\..\..\..\include\bitcoin\network\interfaces\peer_dispatch.hpp">
<Filter>include\bitcoin\network\interfaces</Filter>
</ClInclude>
<ClInclude Include="..\..\..\..\include\bitcoin\network\interfaces\peer_registry.hpp">
<Filter>include\bitcoin\network\interfaces</Filter>
</ClInclude>
<ClInclude Include="..\..\..\..\include\bitcoin\network\log\capture.hpp">
<Filter>include\bitcoin\network\log</Filter>
</ClInclude>
Expand Down Expand Up @@ -983,6 +980,9 @@
<ClInclude Include="..\..\..\..\include\bitcoin\network\messages\peer\peer.hpp">
<Filter>include\bitcoin\network\messages\peer</Filter>
</ClInclude>
<ClInclude Include="..\..\..\..\include\bitcoin\network\messages\peer\registry.hpp">
<Filter>include\bitcoin\network\messages\peer</Filter>
</ClInclude>
<ClInclude Include="..\..\..\..\include\bitcoin\network\messages\rpc\any.hpp">
<Filter>include\bitcoin\network\messages\rpc</Filter>
</ClInclude>
Expand Down
2 changes: 1 addition & 1 deletion include/bitcoin/network.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@
#include <bitcoin/network/interfaces/interfaces.hpp>
#include <bitcoin/network/interfaces/peer_broadcast.hpp>
#include <bitcoin/network/interfaces/peer_dispatch.hpp>
#include <bitcoin/network/interfaces/peer_registry.hpp>
#include <bitcoin/network/log/capture.hpp>
#include <bitcoin/network/log/levels.hpp>
#include <bitcoin/network/log/log.hpp>
Expand All @@ -81,6 +80,7 @@
#include <bitcoin/network/messages/peer/heading.hpp>
#include <bitcoin/network/messages/peer/message.hpp>
#include <bitcoin/network/messages/peer/peer.hpp>
#include <bitcoin/network/messages/peer/registry.hpp>
#include <bitcoin/network/messages/peer/detail/address.hpp>
#include <bitcoin/network/messages/peer/detail/address_item.hpp>
#include <bitcoin/network/messages/peer/detail/alert.hpp>
Expand Down
7 changes: 5 additions & 2 deletions include/bitcoin/network/channels/channel_http.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,11 @@ class BCT_API channel_http
/// Read request buffer (requires strand).
virtual http::flat_buffer& request_buffer() NOEXCEPT;

/// Override to set default websocket reader body.
virtual http::body::value_type websocket_body() const NOEXCEPT;
/// Override to set the preselected reader body.
virtual http::body::value_type default_body() const NOEXCEPT;

/// Override to tolerate json-rpc single value params (electrum laxness).
virtual bool lax_params() const NOEXCEPT;

/// Latch authorization from request headers (requires strand).
virtual void set_authorized(const http::request& request) NOEXCEPT;
Expand Down
3 changes: 2 additions & 1 deletion include/bitcoin/network/channels/channel_peer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include <bitcoin/network/log/log.hpp>
#include <bitcoin/network/memory.hpp>
#include <bitcoin/network/messages/messages.hpp>
#include <bitcoin/network/messages/peer/registry.hpp>

namespace libbitcoin {
namespace network {
Expand Down Expand Up @@ -65,7 +66,7 @@ class BCT_API channel_peer
out.magic = settings().identifier;
out.version = negotiated_version();
out.message = rpc::any_t{ system::to_shared(message) };
out.index = rpc::peer_registry::index_of<Message>();
out.index = messages::peer::registry::index_of<Message>();

LOGX("Send " << Message::command << " to [" << endpoint() << "] ("
<< message.size(out.version) << " bytes)");
Expand Down
7 changes: 4 additions & 3 deletions include/bitcoin/network/interfaces/interfaces.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
#include <bitcoin/network/interfaces/http.hpp>
#include <bitcoin/network/interfaces/peer_broadcast.hpp>
#include <bitcoin/network/interfaces/peer_dispatch.hpp>
#include <bitcoin/network/interfaces/peer_registry.hpp>

namespace libbitcoin {
namespace network {
Expand All @@ -33,8 +32,10 @@ using http = publish<http_methods, grouping::positional>;

namespace peer {

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

} // namespace peer
} // namespace interface
Expand Down
13 changes: 11 additions & 2 deletions include/bitcoin/network/interfaces/peer_broadcast.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ 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
{
method<"addr", messages::peer::address::cptr, key>{},
Expand Down Expand Up @@ -72,14 +73,22 @@ struct peer_broadcast
method<"ping", messages::peer::ping::cptr, key>{},
method<"pong", messages::peer::pong::cptr, key>{},
method<"reject", messages::peer::reject::cptr, key>{},
method<"sendaddrv2", messages::peer::send_address_v2::cptr, key>{},
method<"sendcmpct", messages::peer::send_compact::cptr, key>{},
method<"sendheaders", messages::peer::send_headers::cptr, key>{},
method<"tx", messages::peer::transaction::cptr, key>{},
method<"tx", messages::peer::transaction::cptr, key>{}
};

/// Handshake methods (exchanged before the handshake completes).
static constexpr std::tuple handshake
{
method<"version", messages::peer::version::cptr, key>{},
method<"verack", messages::peer::version_acknowledge::cptr, key>{},
method<"sendaddrv2", messages::peer::send_address_v2::cptr, key>{},
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);
};

} // namespace rpc
Expand Down
13 changes: 11 additions & 2 deletions include/bitcoin/network/interfaces/peer_dispatch.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ 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
{
method<"addr", messages::peer::address::cptr>{},
Expand Down Expand Up @@ -68,14 +69,22 @@ struct peer_dispatch
method<"ping", messages::peer::ping::cptr>{},
method<"pong", messages::peer::pong::cptr>{},
method<"reject", messages::peer::reject::cptr>{},
method<"sendaddrv2", messages::peer::send_address_v2::cptr>{},
method<"sendcmpct", messages::peer::send_compact::cptr>{},
method<"sendheaders", messages::peer::send_headers::cptr>{},
method<"tx", messages::peer::transaction::cptr>{},
method<"tx", messages::peer::transaction::cptr>{}
};

/// Handshake methods (exchanged before the handshake completes).
static constexpr std::tuple handshake
{
method<"version", messages::peer::version::cptr>{},
method<"verack", messages::peer::version_acknowledge::cptr>{},
method<"sendaddrv2", messages::peer::send_address_v2::cptr>{},
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);
};

} // namespace rpc
Expand Down
Loading