mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-08 10:31:50 -05:00
test: drop duplicate getaddrs from p2p_getaddr_caching
python p2p instances will automatically send a getaddr msg after connecting, the explicit message was a duplicate that was being ignored.
This commit is contained in:
parent
feb0096139
commit
8a20f765cc
1 changed files with 2 additions and 7 deletions
|
@ -6,7 +6,6 @@
|
|||
|
||||
import time
|
||||
|
||||
from test_framework.messages import msg_getaddr
|
||||
from test_framework.p2p import (
|
||||
P2PInterface,
|
||||
p2p_lock
|
||||
|
@ -21,6 +20,7 @@ from test_framework.util import (
|
|||
MAX_ADDR_TO_SEND = 1000
|
||||
MAX_PCT_ADDR_TO_SEND = 23
|
||||
|
||||
|
||||
class AddrReceiver(P2PInterface):
|
||||
|
||||
def __init__(self):
|
||||
|
@ -70,11 +70,8 @@ class AddrTest(BitcoinTestFramework):
|
|||
cur_mock_time = int(time.time())
|
||||
for i in range(N):
|
||||
addr_receiver_local = self.nodes[0].add_p2p_connection(AddrReceiver())
|
||||
addr_receiver_local.send_and_ping(msg_getaddr())
|
||||
addr_receiver_onion1 = self.nodes[0].add_p2p_connection(AddrReceiver(), dstport=self.onion_port1)
|
||||
addr_receiver_onion1.send_and_ping(msg_getaddr())
|
||||
addr_receiver_onion2 = self.nodes[0].add_p2p_connection(AddrReceiver(), dstport=self.onion_port2)
|
||||
addr_receiver_onion2.send_and_ping(msg_getaddr())
|
||||
|
||||
# Trigger response
|
||||
cur_mock_time += 5 * 60
|
||||
|
@ -105,11 +102,8 @@ class AddrTest(BitcoinTestFramework):
|
|||
|
||||
self.log.info('After time passed, see a new response to addr request')
|
||||
addr_receiver_local = self.nodes[0].add_p2p_connection(AddrReceiver())
|
||||
addr_receiver_local.send_and_ping(msg_getaddr())
|
||||
addr_receiver_onion1 = self.nodes[0].add_p2p_connection(AddrReceiver(), dstport=self.onion_port1)
|
||||
addr_receiver_onion1.send_and_ping(msg_getaddr())
|
||||
addr_receiver_onion2 = self.nodes[0].add_p2p_connection(AddrReceiver(), dstport=self.onion_port2)
|
||||
addr_receiver_onion2.send_and_ping(msg_getaddr())
|
||||
|
||||
# Trigger response
|
||||
cur_mock_time += 5 * 60
|
||||
|
@ -123,5 +117,6 @@ class AddrTest(BitcoinTestFramework):
|
|||
assert set(last_response_on_onion_bind1) != set(addr_receiver_onion1.get_received_addrs())
|
||||
assert set(last_response_on_onion_bind2) != set(addr_receiver_onion2.get_received_addrs())
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
AddrTest().main()
|
||||
|
|
Loading…
Add table
Reference in a new issue