Skip to content

Commit 3b82bed

Browse files
committed
GH-1101 Do not include connection type in outgoing p2p_address; otherwise type can be set so that trxs are not sent to peer
1 parent 3b80641 commit 3b82bed

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

plugins/net_plugin/net_plugin.cpp

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4254,13 +4254,15 @@ namespace eosio {
42544254
if(hello.sig == chain::signature_type())
42554255
hello.token = sha256();
42564256
hello.p2p_address = listen_address;
4257-
if( is_transactions_only_connection() && hello.p2p_address.find(":trx") == std::string::npos ) hello.p2p_address += ":trx";
4258-
// if we are not accepting transactions tell peer we are blocks only
4259-
if( is_blocks_only_connection() || !my_impl->p2p_accept_transactions )
4260-
if (hello.p2p_address.find(":blk") == std::string::npos)
4261-
hello.p2p_address += ":blk";
4262-
if( !is_blocks_only_connection() && !my_impl->p2p_accept_transactions ) {
4263-
peer_dlog( this, "p2p-accept-transactions=false inform peer blocks only connection ${a}", ("a", hello.p2p_address) );
4257+
if (incoming()) {
4258+
if( is_transactions_only_connection() && hello.p2p_address.find(":trx") == std::string::npos ) hello.p2p_address += ":trx";
4259+
// if we are not accepting transactions tell peer we are blocks only
4260+
if( is_blocks_only_connection() || !my_impl->p2p_accept_transactions )
4261+
if (hello.p2p_address.find(":blk") == std::string::npos)
4262+
hello.p2p_address += ":blk";
4263+
if( !is_blocks_only_connection() && !my_impl->p2p_accept_transactions ) {
4264+
peer_dlog( this, "p2p-accept-transactions=false inform peer blocks only connection ${a}", ("a", hello.p2p_address) );
4265+
}
42644266
}
42654267
hello.p2p_address += " - " + hello.node_id.str().substr(0,7);
42664268
#if defined( __APPLE__ )

0 commit comments

Comments
 (0)