diff options
author | glozow <gloriajzhao@gmail.com> | 2024-04-15 14:59:11 +0100 |
---|---|---|
committer | glozow <gloriajzhao@gmail.com> | 2024-04-15 15:04:07 +0100 |
commit | df609a344e534a8130d8afc12204d894ae32a2f9 (patch) | |
tree | c526f8de0b54d0b3d2f3ef7ba341794544271ec9 /test | |
parent | 22c86140f8fe4f13b7b5415ff62922e497fd4948 (diff) | |
parent | b4c9ace6ff36c54755e4b12f204212c1b938f509 (diff) | |
download | bitcoin-df609a344e534a8130d8afc12204d894ae32a2f9.tar.xz |
Merge bitcoin/bitcoin#29699: test: check disconnection when sending sendaddrv2 after verack
b4c9ace6ff36c54755e4b12f204212c1b938f509 test: check disconnection when sending sendaddrv2 after verack (brunoerg)
Pull request description:
This PR adds test coverage for:
https://github.com/bitcoin/bitcoin/blob/71b63195b30b2fa0dff20ebb262ce7566dd5d673/src/net_processing.cpp#L3796-L3807
ACKs for top commit:
maflcko:
lgtm ACK b4c9ace6ff36c54755e4b12f204212c1b938f509
byaye:
Tested ACK b4c9ace6ff36c54755e4b12f204212c1b938f509
Tree-SHA512: 2ad49a269cb64794b8d626941cf532acafdbe6e97f3da5ccb52f3201a6773d2f5e3d7d62ce4289334b85d578790d4dd5833f6b8ba54bd49a8418a20aee0c3e5f
Diffstat (limited to 'test')
-rwxr-xr-x | test/functional/p2p_addrv2_relay.py | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/test/functional/p2p_addrv2_relay.py b/test/functional/p2p_addrv2_relay.py index f9a8c44be2..ea114e7d70 100755 --- a/test/functional/p2p_addrv2_relay.py +++ b/test/functional/p2p_addrv2_relay.py @@ -11,6 +11,7 @@ import time from test_framework.messages import ( CAddress, msg_addrv2, + msg_sendaddrv2, ) from test_framework.p2p import ( P2PInterface, @@ -75,6 +76,12 @@ class AddrTest(BitcoinTestFramework): self.extra_args = [["-whitelist=addr@127.0.0.1"]] def run_test(self): + self.log.info('Check disconnection when sending sendaddrv2 after verack') + conn = self.nodes[0].add_p2p_connection(P2PInterface()) + with self.nodes[0].assert_debug_log(['sendaddrv2 received after verack from peer=0; disconnecting']): + conn.send_message(msg_sendaddrv2()) + conn.wait_for_disconnect() + self.log.info('Create connection that sends addrv2 messages') addr_source = self.nodes[0].add_p2p_connection(P2PInterface()) msg = msg_addrv2() @@ -89,8 +96,8 @@ class AddrTest(BitcoinTestFramework): msg.addrs = ADDRS msg_size = calc_addrv2_msg_size(ADDRS) with self.nodes[0].assert_debug_log([ - f'received: addrv2 ({msg_size} bytes) peer=0', - f'sending addrv2 ({msg_size} bytes) peer=1', + f'received: addrv2 ({msg_size} bytes) peer=1', + f'sending addrv2 ({msg_size} bytes) peer=2', ]): addr_source.send_and_ping(msg) self.nodes[0].setmocktime(int(time.time()) + 30 * 60) |