Merge #18228: test: Add missing syncwithvalidationinterfacequeue

faf6f156ffd1a8ed1aed047428d791a8c13c162b 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:
    ACK faf6f156 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:
MarcoFalke 2020-03-12 09:20:42 -04:00 committed by Pasta
parent a60f648ed7
commit 37634112f2
No known key found for this signature in database
GPG Key ID: 52527BEDABE87984

View File

@ -12,6 +12,7 @@ from test_framework.mininode import P2PInterface, mininode_lock
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import assert_equal, wait_until
class P2PStoreTxInvs(P2PInterface):
def __init__(self):
super().__init__()
@ -24,6 +25,7 @@ class P2PStoreTxInvs(P2PInterface):
# save txid
self.tx_invs_received[i.hash] += 1
class ResendWalletTransactionsTest(BitcoinTestFramework):
def set_test_params(self):
self.num_nodes = 1
@ -67,6 +69,7 @@ class ResendWalletTransactionsTest(BitcoinTestFramework):
node.submitblock(ToHex(block))
# Transaction should not be rebroadcast
node.syncwithvalidationinterfacequeue()
node.p2ps[1].sync_with_ping()
assert_equal(node.p2ps[1].tx_invs_received[txid], 0)
@ -81,5 +84,6 @@ class ResendWalletTransactionsTest(BitcoinTestFramework):
return node.p2ps[1].tx_invs_received[txid] >= 1
wait_until(wait_p2p_1, lock=mininode_lock)
if __name__ == '__main__':
ResendWalletTransactionsTest().main()