mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-06-04 02:02:42 +02:00
test: Introduce ensure_for helper
This commit is contained in:
@@ -6,7 +6,6 @@
|
||||
import os
|
||||
import struct
|
||||
import tempfile
|
||||
from time import sleep
|
||||
from io import BytesIO
|
||||
|
||||
from test_framework.address import (
|
||||
@@ -27,6 +26,7 @@ from test_framework.messages import (
|
||||
from test_framework.util import (
|
||||
assert_equal,
|
||||
assert_raises_rpc_error,
|
||||
ensure_for,
|
||||
p2p_port,
|
||||
)
|
||||
from test_framework.wallet import (
|
||||
@@ -394,11 +394,10 @@ class ZMQTest (BitcoinTestFramework):
|
||||
block_count = self.nodes[0].getblockcount()
|
||||
best_hash = self.nodes[0].getbestblockhash()
|
||||
self.nodes[0].invalidateblock(best_hash)
|
||||
sleep(2) # Bit of room to make sure transaction things happened
|
||||
|
||||
# Make sure getrawmempool mempool_sequence results aren't "queued" but immediately reflective
|
||||
# of the time they were gathered.
|
||||
assert self.nodes[0].getrawmempool(mempool_sequence=True)["mempool_sequence"] > seq_num
|
||||
ensure_for(duration=2, f=lambda: self.nodes[0].getrawmempool(mempool_sequence=True)["mempool_sequence"] > seq_num)
|
||||
|
||||
assert_equal((best_hash, "D", None), seq.receive_sequence())
|
||||
assert_equal((rbf_txid, "A", seq_num), seq.receive_sequence())
|
||||
|
||||
Reference in New Issue
Block a user