mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-25 10:43:19 -03:00
[net processing] Do not request transaction relay from feeler connections
Add a test to verify that feeler connections do not request transaction relay.
This commit is contained in:
parent
0220b834b1
commit
eaf6be0114
2 changed files with 3 additions and 1 deletions
|
@ -1096,7 +1096,7 @@ void PeerManagerImpl::PushNodeVersion(CNode& pnode, int64_t nTime)
|
||||||
CService addr_you = addr.IsRoutable() && !IsProxy(addr) && addr.IsAddrV1Compatible() ? addr : CService();
|
CService addr_you = addr.IsRoutable() && !IsProxy(addr) && addr.IsAddrV1Compatible() ? addr : CService();
|
||||||
uint64_t your_services{addr.nServices};
|
uint64_t your_services{addr.nServices};
|
||||||
|
|
||||||
const bool tx_relay = !m_ignore_incoming_txs && pnode.m_tx_relay != nullptr;
|
const bool tx_relay = !m_ignore_incoming_txs && pnode.m_tx_relay != nullptr && !pnode.IsFeelerConn();
|
||||||
m_connman.PushMessage(&pnode, CNetMsgMaker(INIT_PROTO_VERSION).Make(NetMsgType::VERSION, PROTOCOL_VERSION, my_services, nTime,
|
m_connman.PushMessage(&pnode, CNetMsgMaker(INIT_PROTO_VERSION).Make(NetMsgType::VERSION, PROTOCOL_VERSION, my_services, nTime,
|
||||||
your_services, addr_you, // Together the pre-version-31402 serialization of CAddress "addrYou" (without nTime)
|
your_services, addr_you, // Together the pre-version-31402 serialization of CAddress "addrYou" (without nTime)
|
||||||
my_services, CService(), // Together the pre-version-31402 serialization of CAddress "addrMe" (without nTime)
|
my_services, CService(), // Together the pre-version-31402 serialization of CAddress "addrMe" (without nTime)
|
||||||
|
|
|
@ -106,6 +106,8 @@ class P2PAddConnections(BitcoinTestFramework):
|
||||||
|
|
||||||
# Verify version message received
|
# Verify version message received
|
||||||
assert_equal(feeler_conn.message_count["version"], 1)
|
assert_equal(feeler_conn.message_count["version"], 1)
|
||||||
|
# Feeler connections do not request tx relay
|
||||||
|
assert_equal(feeler_conn.last_message["version"].relay, 0)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
P2PAddConnections().main()
|
P2PAddConnections().main()
|
||||||
|
|
Loading…
Add table
Reference in a new issue