mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 20:12:57 +01:00
Merge #14964: test: Fix race in mempool_accept
faee59103d test: Fix race in mempool_accept (MarcoFalke) Pull request description: If we happen to pick the same random coin to spend, there would be mempool conflicts in some runs of the test. Fix that by popping from a static list of coins to spend from. Tree-SHA512: f6fd37e43d919371aa8bc3a2c93b569f9169961fe702f3641bb63180c3a88f12ca1857e9ed4d3723d5f04ca8ab5ef009a90e679580f36246a10b987620a55bee
This commit is contained in:
parent
9273ffd338
commit
1fb61d1b66
@ -54,6 +54,7 @@ class MempoolAcceptanceTest(BitcoinTestFramework):
|
|||||||
self.mempool_size = 0
|
self.mempool_size = 0
|
||||||
wait_until(lambda: node.getblockcount() == 200)
|
wait_until(lambda: node.getblockcount() == 200)
|
||||||
assert_equal(node.getmempoolinfo()['size'], self.mempool_size)
|
assert_equal(node.getmempoolinfo()['size'], self.mempool_size)
|
||||||
|
coins = node.listunspent()
|
||||||
|
|
||||||
self.log.info('Should not accept garbage to testmempoolaccept')
|
self.log.info('Should not accept garbage to testmempoolaccept')
|
||||||
assert_raises_rpc_error(-3, 'Expected type array, got string', lambda: node.testmempoolaccept(rawtxs='ff00baar'))
|
assert_raises_rpc_error(-3, 'Expected type array, got string', lambda: node.testmempoolaccept(rawtxs='ff00baar'))
|
||||||
@ -61,7 +62,7 @@ class MempoolAcceptanceTest(BitcoinTestFramework):
|
|||||||
assert_raises_rpc_error(-22, 'TX decode failed', lambda: node.testmempoolaccept(rawtxs=['ff00baar']))
|
assert_raises_rpc_error(-22, 'TX decode failed', lambda: node.testmempoolaccept(rawtxs=['ff00baar']))
|
||||||
|
|
||||||
self.log.info('A transaction already in the blockchain')
|
self.log.info('A transaction already in the blockchain')
|
||||||
coin = node.listunspent()[0] # Pick a random coin(base) to spend
|
coin = coins.pop() # Pick a random coin(base) to spend
|
||||||
raw_tx_in_block = node.signrawtransactionwithwallet(node.createrawtransaction(
|
raw_tx_in_block = node.signrawtransactionwithwallet(node.createrawtransaction(
|
||||||
inputs=[{'txid': coin['txid'], 'vout': coin['vout']}],
|
inputs=[{'txid': coin['txid'], 'vout': coin['vout']}],
|
||||||
outputs=[{node.getnewaddress(): 0.3}, {node.getnewaddress(): 49}],
|
outputs=[{node.getnewaddress(): 0.3}, {node.getnewaddress(): 49}],
|
||||||
@ -89,7 +90,7 @@ class MempoolAcceptanceTest(BitcoinTestFramework):
|
|||||||
)
|
)
|
||||||
|
|
||||||
self.log.info('A final transaction not in the mempool')
|
self.log.info('A final transaction not in the mempool')
|
||||||
coin = node.listunspent()[0] # Pick a random coin(base) to spend
|
coin = coins.pop() # Pick a random coin(base) to spend
|
||||||
raw_tx_final = node.signrawtransactionwithwallet(node.createrawtransaction(
|
raw_tx_final = node.signrawtransactionwithwallet(node.createrawtransaction(
|
||||||
inputs=[{'txid': coin['txid'], 'vout': coin['vout'], "sequence": 0xffffffff}], # SEQUENCE_FINAL
|
inputs=[{'txid': coin['txid'], 'vout': coin['vout'], "sequence": 0xffffffff}], # SEQUENCE_FINAL
|
||||||
outputs=[{node.getnewaddress(): 0.025}],
|
outputs=[{node.getnewaddress(): 0.025}],
|
||||||
|
Loading…
Reference in New Issue
Block a user