mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-19 14:53:43 +01:00
Merge bitcoin/bitcoin#34204: test: fix intermittent failure in p2p_addr_selfannouncement
31852057eatest: fix intermittent failure in p2p_addr_selfannouncement (0xb10c) Pull request description: Due to the mocktime being bumped before the expected time is updated, it could happen that the self-announcement is send with an newer timestamp than what we expect. To fix this, update the expected time before we bump the mocktime. closes #34159 ACKs for top commit: bensig: ACK31852057eamaflcko: lgtm ACK31852057eaw0xlt: ACK31852057eanaiyoma: utACK31852057eaTree-SHA512: 24696f6005c7131d4c9328f6ff43ddded863b8ba6b2cac6f6009bcb4617616c0c35a0b55812d5010f74385d8e6d4ea09dd2b06b5f4ada2bb7e86d7abee764192
This commit is contained in:
@@ -128,8 +128,8 @@ class AddrSelfAnnouncementTest(BitcoinTestFramework):
|
||||
# self-announcements are sent on an exponential distribution with mean interval of 24h.
|
||||
# Setting the mocktime 20d forward gives a probability of (1 - e^-(480/24)) that
|
||||
# the event will occur (i.e. this fails once in ~500 million repeats).
|
||||
addr_receiver.expected.time = self.nodes[0].mocktime + 20 * ONE_DAY
|
||||
self.nodes[0].bumpmocktime(20 * ONE_DAY)
|
||||
addr_receiver.expected.time = self.nodes[0].mocktime
|
||||
addr_receiver.sync_with_ping()
|
||||
|
||||
assert_equal(addr_receiver.self_announcements_received, last_self_announcements_received + 1)
|
||||
|
||||
Reference in New Issue
Block a user