Skip to content

Commit a654723

Browse files
committed
GH-1101 Ignore block requests on trx only connections
1 parent bb55a41 commit a654723

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

plugins/net_plugin/net_plugin.cpp

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3721,15 +3721,21 @@ namespace eosio {
37213721
switch (msg.req_blocks.mode) {
37223722
case catch_up : {
37233723
const block_id_type& id = msg.req_blocks.ids.empty() ? block_id_type() : msg.req_blocks.ids.back();
3724-
peer_dlog( this, "received request_message:catch_up #${bn}:${id}", ("bn", block_header::num_from_id(id))("id",id) );
3724+
peer_dlog( this, "${d} request_message:catch_up #${bn}:${id}",
3725+
("d", is_blocks_connection() ? "received" : "ignoring")("bn", block_header::num_from_id(id))("id",id) );
3726+
if (!is_blocks_connection())
3727+
return;
37253728
blk_send_branch( id );
3726-
break;
3729+
return;
37273730
}
37283731
case normal : {
37293732
if (protocol_version >= proto_block_nack) {
37303733
if (!msg.req_blocks.ids.empty()) {
37313734
const block_id_type& id = msg.req_blocks.ids.back();
3732-
peer_dlog( this, "received request_message:normal #${bn}:${id}", ("bn", block_header::num_from_id(id))("id",id) );
3735+
peer_dlog( this, "${d} request_message:normal #${bn}:${id}",
3736+
("d", is_blocks_connection() ? "received" : "ignoring")("bn", block_header::num_from_id(id))("id",id) );
3737+
if (!is_blocks_connection())
3738+
return;
37333739
uint32_t head_num = my_impl->get_chain_head_num();
37343740
auto msg_head_num = block_header::num_from_id(id);
37353741
// --msg_head_num since blk_send_branch adds one to request and we need to start at msg_head_num
@@ -3771,6 +3777,11 @@ namespace eosio {
37713777
peer_requested.reset();
37723778
flush_queues();
37733779
} else {
3780+
if (!is_blocks_connection()) {
3781+
peer_dlog(this, "received sync_request_message ${m} on transaction only connection, ignoring", ("m", msg));
3782+
return;
3783+
}
3784+
37743785
if (peer_requested) {
37753786
// This happens when peer already requested some range and sync is still in progress
37763787
// It could be higher in case of peer requested head catchup and current request is lib catchup

0 commit comments

Comments
 (0)