Skip to content

Commit fb5fc0e

Browse files
committed
Attach reject protocol to standard sessions.
1 parent 3322fab commit fb5fc0e

5 files changed

Lines changed: 23 additions & 4 deletions

File tree

src/protocols/protocol_block_in.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -365,6 +365,8 @@ bool protocol_block_in::handle_reorganized(code ec, size_t fork_height,
365365
if (stopped(ec))
366366
return false;
367367

368+
// TODO: differentiate failure conditions and send reject as applicable.
369+
368370
if (ec)
369371
{
370372
LOG_ERROR(LOG_NODE)

src/protocols/protocol_transaction_in.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,9 @@ void protocol_transaction_in::handle_store_transaction(const code& ec,
176176
// is not generally okay to receive an otherwise invalid transaction.
177177
// Below-fee transactions can be sent prior to fee_filter receipt or due to
178178
// a negotiated version below BIP133 (7013).
179-
// TODO: differentiate these situations and send reject as applicable.
179+
180+
// TODO: differentiate failure conditions and send reject as applicable.
181+
180182
if (ec)
181183
{
182184
// This should not happen with a single peer since we filter inventory.

src/sessions/session_inbound.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,16 @@ session_inbound::session_inbound(full_node& network, safe_chain& chain)
4545

4646
void session_inbound::attach_protocols(channel::ptr channel)
4747
{
48-
if (channel->negotiated_version() >= version::level::bip31)
48+
const auto version = channel->negotiated_version();
49+
50+
if (version >= version::level::bip31)
4951
attach<protocol_ping_60001>(channel)->start();
5052
else
5153
attach<protocol_ping_31402>(channel)->start();
5254

55+
if (version >= message::version::level::bip61)
56+
attach<protocol_reject_70002>(channel)->start();
57+
5358
attach<protocol_address_31402>(channel)->start();
5459
attach<protocol_block_in>(channel, chain_)->start();
5560
attach<protocol_block_out>(channel, chain_)->start();

src/sessions/session_manual.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,16 @@ session_manual::session_manual(full_node& network, safe_chain& chain)
4545

4646
void session_manual::attach_protocols(channel::ptr channel)
4747
{
48-
if (channel->negotiated_version() >= version::level::bip31)
48+
const auto version = channel->negotiated_version();
49+
50+
if (version >= version::level::bip31)
4951
attach<protocol_ping_60001>(channel)->start();
5052
else
5153
attach<protocol_ping_31402>(channel)->start();
5254

55+
if (version >= message::version::level::bip61)
56+
attach<protocol_reject_70002>(channel)->start();
57+
5358
attach<protocol_address_31402>(channel)->start();
5459
attach<protocol_block_in>(channel, chain_)->start();
5560
attach<protocol_block_out>(channel, chain_)->start();

src/sessions/session_outbound.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,16 @@ session_outbound::session_outbound(full_node& network, safe_chain& chain)
4545

4646
void session_outbound::attach_protocols(channel::ptr channel)
4747
{
48-
if (channel->negotiated_version() >= version::level::bip31)
48+
const auto version = channel->negotiated_version();
49+
50+
if (version >= version::level::bip31)
4951
attach<protocol_ping_60001>(channel)->start();
5052
else
5153
attach<protocol_ping_31402>(channel)->start();
5254

55+
if (version >= message::version::level::bip61)
56+
attach<protocol_reject_70002>(channel)->start();
57+
5358
attach<protocol_address_31402>(channel)->start();
5459
attach<protocol_block_in>(channel, chain_)->start();
5560
attach<protocol_block_out>(channel, chain_)->start();

0 commit comments

Comments
 (0)