@@ -58,14 +58,15 @@ def run_test(self):
58
58
self .mempool_size = 0
59
59
wait_until (lambda : node .getblockcount () == 200 )
60
60
assert_equal (node .getmempoolinfo ()['size' ], self .mempool_size )
61
+ coins = node .listunspent ()
61
62
62
63
self .log .info ('Should not accept garbage to testmempoolaccept' )
63
64
assert_raises_rpc_error (- 3 , 'Expected type array, got string' , lambda : node .testmempoolaccept (rawtxs = 'ff00baar' ))
64
65
assert_raises_rpc_error (- 8 , 'Array must contain exactly one raw transaction for now' , lambda : node .testmempoolaccept (rawtxs = ['ff00baar' , 'ff22' ]))
65
66
assert_raises_rpc_error (- 22 , 'TX decode failed' , lambda : node .testmempoolaccept (rawtxs = ['ff00baar' ]))
66
67
67
68
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
69
70
raw_tx_in_block = node .signrawtransactionwithwallet (node .createrawtransaction (
70
71
inputs = [{'txid' : coin ['txid' ], 'vout' : coin ['vout' ]}],
71
72
outputs = [{node .getnewaddress (): 0.3 }, {node .getnewaddress (): 49 }],
@@ -93,7 +94,7 @@ def run_test(self):
93
94
)
94
95
95
96
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
97
98
raw_tx_final = node .signrawtransactionwithwallet (node .createrawtransaction (
98
99
inputs = [{'txid' : coin ['txid' ], 'vout' : coin ['vout' ], "sequence" : 0xffffffff }], # SEQUENCE_FINAL
99
100
outputs = [{node .getnewaddress (): 0.025 }],
0 commit comments