From c322bddd08ed1f1f7f0c39768b659dd62d5e2dd5 Mon Sep 17 00:00:00 2001 From: stratospher <44024636+stratospher@users.noreply.github.com> Date: Wed, 17 Jul 2024 15:55:14 +0530 Subject: [PATCH] test: bump mocktime after node has received and sent bytes a different error message "socket no message in first %i seconds" will be displayed if m_last_send=0 or if m_last_recv is 0. make the test robust by ensuring that they will not be 0 before bumping mocktime. --- test/functional/p2p_v2_misbehaving.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/functional/p2p_v2_misbehaving.py b/test/functional/p2p_v2_misbehaving.py index 9017ee94559..0789425bcb9 100755 --- a/test/functional/p2p_v2_misbehaving.py +++ b/test/functional/p2p_v2_misbehaving.py @@ -147,11 +147,11 @@ class EncryptedP2PMisbehaving(BitcoinTestFramework): peer1.v2_state.can_data_be_received = True self.wait_until(lambda: peer1.v2_state.ellswift_ours) peer1.send_raw_message(peer1.v2_state.ellswift_ours[4:] + peer1.v2_state.sent_garbage) - node0.bumpmocktime(3) # Ensure that the bytes sent after 4 bytes network magic are actually received. self.wait_until(lambda: node0.getpeerinfo()[-1]["bytesrecv"] > 4) + self.wait_until(lambda: node0.getpeerinfo()[-1]["bytessent"] > 0) with node0.assert_debug_log(['V2 handshake timeout peer=0']): - node0.bumpmocktime(1) # `InactivityCheck()` triggers now + node0.bumpmocktime(4) # `InactivityCheck()` triggers now peer1.wait_for_disconnect(timeout=1) self.log.info('successful disconnection since modified ellswift was sent as response')