Skip to content

Commit cce034b

Browse files
author
MarcoFalke
committed
Merge #18839: test: Fix intermittent issues
fab7ee3 test: Fix p2p_leak intermittent issue (MarcoFalke) fa8614a test: Fix intermittent p2p_segwit issue (MarcoFalke) Pull request description: Fixes #18801 Fixes #18802 ACKs for top commit: practicalswift: ACK fab7ee3 -- diff looks correct Tree-SHA512: b5d0473ec1133aded127bef4c0c90f6b55906327cb49cbbd0776c4971cd9d5c9375fb70cc3dc8dd1f4bd8b1245c4414e803dc0d29ed4553b00eb131d27c9c128
2 parents ddc0a60 + fab7ee3 commit cce034b

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

test/functional/p2p_leak.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -141,12 +141,11 @@ def run_test(self):
141141
assert no_verack_idlenode.unexpected_msg == False
142142

143143
self.log.info('Check that the version message does not leak the local address of the node')
144-
time_begin = int(time.time())
145144
p2p_version_store = self.nodes[0].add_p2p_connection(P2PVersionStore())
146-
time_end = time.time()
147145
ver = p2p_version_store.version_received
148-
assert_greater_than_or_equal(ver.nTime, time_begin)
149-
assert_greater_than_or_equal(time_end, ver.nTime)
146+
# Check that received time is within one hour of now
147+
assert_greater_than_or_equal(ver.nTime, time.time() - 3600)
148+
assert_greater_than_or_equal(time.time() + 3600, ver.nTime)
150149
assert_equal(ver.addrFrom.port, 0)
151150
assert_equal(ver.addrFrom.ip, '0.0.0.0')
152151
assert_equal(ver.nStartingHeight, 201)

test/functional/p2p_segwit.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1896,12 +1896,12 @@ def test_non_standard_witness(self):
18961896
def test_upgrade_after_activation(self):
18971897
"""Test the behavior of starting up a segwit-aware node after the softfork has activated."""
18981898

1899-
# Restart with the new binary
19001899
self.stop_node(2)
19011900
self.start_node(2, extra_args=["-segwitheight={}".format(SEGWIT_HEIGHT)])
19021901
connect_nodes(self.nodes[0], 2)
19031902

1904-
self.sync_blocks()
1903+
# We reconnect more than 100 blocks, give it plenty of time
1904+
self.sync_blocks(timeout=240)
19051905

19061906
# Make sure that this peer thinks segwit has activated.
19071907
assert softfork_active(self.nodes[2], 'segwit')

0 commit comments

Comments
 (0)