Skip to content

Commit

Permalink
test: bump mocktime after node has received and sent bytes
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
stratospher committed Jul 17, 2024
1 parent 6f9db1e commit 2064c75
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions test/functional/p2p_v2_misbehaving.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ def set_test_params(self):

def run_test(self):
self.test_earlykeyresponse()
self.test_v2disconnection()
# self.test_v2disconnection()

def test_earlykeyresponse(self):
self.log.info('Sending ellswift bytes in parts to ensure that response from responder is received only when')
Expand All @@ -147,11 +147,11 @@ def test_earlykeyresponse(self):
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')

Expand Down

0 comments on commit 2064c75

Please sign in to comment.