mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-09 10:43:19 -05:00
Merge #18228: test: Add missing syncwithvalidationinterfacequeue
faf6f156ff
test: Add missing syncwithvalidationinterfacequeue (MarcoFalke) Pull request description: The wallet rebroadcast functionality learns about new blocks via the validation interface queue. To avoid test failures such as https://ci.appveyor.com/project/DrahtBot/bitcoin/builds/31119387#L466 , we can sync with the queue before advancing the test. ACKs for top commit: jonatack: ACKfaf6f156
this makes sense; the fix was previously added to mempool_persist.py and wallet_zapwallettxes.py in #12217 and to wallet_balance.py in #16302. It is also used in src/test/validation_block_tests.cpp (processnewblock_signals_ordering) and src/bench/wallet_balance.cpp. Tree-SHA512: d72fd4b597b669d8111007902b523e946712913cd6eea6f9a695b0f04ecbe2321d05019873af999a95b9e0aa0f5c140a17109b37503723e40c9eab24ec358eb7
This commit is contained in:
commit
e2d36639ca
1 changed files with 4 additions and 0 deletions
|
@ -12,6 +12,7 @@ from test_framework.mininode import P2PInterface, mininode_lock
|
||||||
from test_framework.test_framework import BitcoinTestFramework
|
from test_framework.test_framework import BitcoinTestFramework
|
||||||
from test_framework.util import assert_equal, wait_until
|
from test_framework.util import assert_equal, wait_until
|
||||||
|
|
||||||
|
|
||||||
class P2PStoreTxInvs(P2PInterface):
|
class P2PStoreTxInvs(P2PInterface):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
|
@ -24,6 +25,7 @@ class P2PStoreTxInvs(P2PInterface):
|
||||||
# save txid
|
# save txid
|
||||||
self.tx_invs_received[i.hash] += 1
|
self.tx_invs_received[i.hash] += 1
|
||||||
|
|
||||||
|
|
||||||
class ResendWalletTransactionsTest(BitcoinTestFramework):
|
class ResendWalletTransactionsTest(BitcoinTestFramework):
|
||||||
def set_test_params(self):
|
def set_test_params(self):
|
||||||
self.num_nodes = 1
|
self.num_nodes = 1
|
||||||
|
@ -63,6 +65,7 @@ class ResendWalletTransactionsTest(BitcoinTestFramework):
|
||||||
node.submitblock(ToHex(block))
|
node.submitblock(ToHex(block))
|
||||||
|
|
||||||
# Transaction should not be rebroadcast
|
# Transaction should not be rebroadcast
|
||||||
|
node.syncwithvalidationinterfacequeue()
|
||||||
node.p2ps[1].sync_with_ping()
|
node.p2ps[1].sync_with_ping()
|
||||||
assert_equal(node.p2ps[1].tx_invs_received[txid], 0)
|
assert_equal(node.p2ps[1].tx_invs_received[txid], 0)
|
||||||
|
|
||||||
|
@ -72,5 +75,6 @@ class ResendWalletTransactionsTest(BitcoinTestFramework):
|
||||||
node.setmocktime(rebroadcast_time)
|
node.setmocktime(rebroadcast_time)
|
||||||
wait_until(lambda: node.p2ps[1].tx_invs_received[txid] >= 1, lock=mininode_lock)
|
wait_until(lambda: node.p2ps[1].tx_invs_received[txid] >= 1, lock=mininode_lock)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
ResendWalletTransactionsTest().main()
|
ResendWalletTransactionsTest().main()
|
||||||
|
|
Loading…
Add table
Reference in a new issue