@@ -58,14 +58,15 @@ def run_test(self):
5858 self .mempool_size = 0
5959 wait_until (lambda : node .getblockcount () == 200 )
6060 assert_equal (node .getmempoolinfo ()['size' ], self .mempool_size )
61+ coins = node .listunspent ()
6162
6263 self .log .info ('Should not accept garbage to testmempoolaccept' )
6364 assert_raises_rpc_error (- 3 , 'Expected type array, got string' , lambda : node .testmempoolaccept (rawtxs = 'ff00baar' ))
6465 assert_raises_rpc_error (- 8 , 'Array must contain exactly one raw transaction for now' , lambda : node .testmempoolaccept (rawtxs = ['ff00baar' , 'ff22' ]))
6566 assert_raises_rpc_error (- 22 , 'TX decode failed' , lambda : node .testmempoolaccept (rawtxs = ['ff00baar' ]))
6667
6768 self .log .info ('A transaction already in the blockchain' )
68- coin = node . listunspent ()[ 0 ] # Pick a random coin(base) to spend
69+ coin = coins . pop () # Pick a random coin(base) to spend
6970 raw_tx_in_block = node .signrawtransactionwithwallet (node .createrawtransaction (
7071 inputs = [{'txid' : coin ['txid' ], 'vout' : coin ['vout' ]}],
7172 outputs = [{node .getnewaddress (): 0.3 }, {node .getnewaddress (): 49 }],
@@ -93,7 +94,7 @@ def run_test(self):
9394 )
9495
9596 self .log .info ('A final transaction not in the mempool' )
96- coin = node . listunspent ()[ 0 ] # Pick a random coin(base) to spend
97+ coin = coins . pop () # Pick a random coin(base) to spend
9798 raw_tx_final = node .signrawtransactionwithwallet (node .createrawtransaction (
9899 inputs = [{'txid' : coin ['txid' ], 'vout' : coin ['vout' ], "sequence" : 0xffffffff }], # SEQUENCE_FINAL
99100 outputs = [{node .getnewaddress (): 0.025 }],
0 commit comments