2828namespace libbitcoin {
2929namespace node {
3030
31- class session_outbound ;
31+ class full_node ;
3232
3333// / Session base class template for protocol attachment.
3434// / node::session does not derive from network::session (siblings).
@@ -40,21 +40,7 @@ class attach
4040{
4141public:
4242 attach (full_node& node, uint64_t identifier) NOEXCEPT
43- : Session(node, identifier),
44- session (node),
45- relay_(node.config().network.enable_relay),
46- delay_(node.config().node.delay_inbound),
47- headers_(node.config().node.headers_first),
48- node_network_(to_bool(system::bit_and<uint64_t >
49- (
50- node.config().network.services_maximum,
51- network::messages::peer::service::node_network
52- ))),
53- node_client_filters_(to_bool(system::bit_and<uint64_t >
54- (
55- node.config().network.services_maximum,
56- network::messages::peer::service::node_client_filters
57- )))
43+ : Session(node, identifier), session(node)
5844 {
5945 }
6046
@@ -72,6 +58,20 @@ class attach
7258
7359 void attach_protocols (const network::channel::ptr& channel) NOEXCEPT override
7460 {
61+ const auto relay = config ().network .enable_relay ;
62+ const auto delay = node.config ().node .delay_inbound ;
63+ const auto headers = node.config ().node .headers_first ;
64+ const auto node_network = to_bool (system::bit_and<uint64_t >
65+ (
66+ node.config ().network .services_maximum ,
67+ network::messages::peer::service::node_network
68+ ));
69+ const auto node_client_filters = to_bool (system::bit_and<uint64_t >
70+ (
71+ node.config ().network .services_maximum ,
72+ network::messages::peer::service::node_client_filters
73+ ));
74+
7575 using namespace network ::messages::peer;
7676 const auto self = session::shared_from_sibling<attach<Session>,
7777 network::session>();
@@ -83,7 +83,7 @@ class attach
8383 channel->attach <protocol_observer>(self)->start ();
8484
8585 // Ready to relay blocks or block filters.
86- const auto blocks_out = !delay_ || is_recent ();
86+ const auto blocks_out = !delay || is_recent ();
8787
8888 // /////////////////////////////////////////////////////////////////////
8989 // bip152: "Upon receipt of a `sendcmpct` message with the first and
@@ -101,12 +101,12 @@ class attach
101101 channel->attach <protocol_filter_out_70015>(self)->start ();
102102
103103 // Node must advertise node_network or no in|out blocks|txs.
104- if (!node_network_ )
104+ if (!node_network )
105105 return ;
106106
107107 // Ready to relay transactions.
108- const auto txs_in_out = relay_ && peer->is_negotiated (level::bip37) &&
109- (!delay_ || is_current (true ));
108+ const auto txs_in_out = relay && peer->is_negotiated (level::bip37) &&
109+ (!delay || is_current (true ));
110110
111111 // Peer advertises chain (blocks in).
112112 if (peer->is_peer_service (service::node_network))
@@ -164,14 +164,6 @@ class attach
164164 network::session::log, socket, node::session::config (),
165165 network::session::create_key ()));
166166 }
167-
168- private:
169- // These are thread safe.
170- const bool relay_;
171- const bool delay_;
172- const bool headers_;
173- const bool node_network_;
174- const bool node_client_filters_;
175167};
176168
177169} // namespace node
0 commit comments