@@ -992,31 +992,31 @@ def test_include_unsafe(self):
992
992
993
993
# We receive unconfirmed funds from external keys (unsafe outputs).
994
994
addr = wallet .getnewaddress ()
995
- txid1 = self .nodes [2 ].sendtoaddress (addr , 6 )
996
- txid2 = self .nodes [2 ].sendtoaddress (addr , 4 )
997
- self .sync_all ()
998
- vout1 = find_vout_for_address (wallet , txid1 , addr )
999
- vout2 = find_vout_for_address (wallet , txid2 , addr )
995
+ inputs = []
996
+ for i in range (0 , 2 ):
997
+ txid = self .nodes [2 ].sendtoaddress (addr , 5 )
998
+ self .sync_mempools ()
999
+ vout = find_vout_for_address (wallet , txid , addr )
1000
+ inputs .append ((txid , vout ))
1000
1001
1001
1002
# Unsafe inputs are ignored by default.
1002
- rawtx = wallet .createrawtransaction ([], [{self .nodes [2 ].getnewaddress (): 5 }])
1003
+ rawtx = wallet .createrawtransaction ([], [{self .nodes [2 ].getnewaddress (): 7. 5 }])
1003
1004
assert_raises_rpc_error (- 4 , "Insufficient funds" , wallet .fundrawtransaction , rawtx )
1004
1005
1005
1006
# But we can opt-in to use them for funding.
1006
1007
fundedtx = wallet .fundrawtransaction (rawtx , {"include_unsafe" : True })
1007
1008
tx_dec = wallet .decoderawtransaction (fundedtx ['hex' ])
1008
- assert any ([ txin [' txid' ] == txid1 and txin [' vout' ] == vout1 for txin in tx_dec [' vin' ] ])
1009
+ assert all (( txin [" txid" ], txin [" vout" ]) in inputs for txin in tx_dec [" vin" ])
1009
1010
signedtx = wallet .signrawtransactionwithwallet (fundedtx ['hex' ])
1010
- wallet .sendrawtransaction ( signedtx ['hex' ])
1011
+ assert wallet .testmempoolaccept ([ signedtx ['hex' ]])[ 0 ][ "allowed" ]
1011
1012
1012
1013
# And we can also use them once they're confirmed.
1013
1014
self .generate (self .nodes [0 ], 1 )
1014
- rawtx = wallet .createrawtransaction ([], [{self .nodes [2 ].getnewaddress (): 3 }])
1015
- fundedtx = wallet .fundrawtransaction (rawtx , {"include_unsafe" : True })
1015
+ fundedtx = wallet .fundrawtransaction (rawtx , {"include_unsafe" : False })
1016
1016
tx_dec = wallet .decoderawtransaction (fundedtx ['hex' ])
1017
- assert any ([ txin [' txid' ] == txid2 and txin [' vout' ] == vout2 for txin in tx_dec [' vin' ] ])
1017
+ assert all (( txin [" txid" ], txin [" vout" ]) in inputs for txin in tx_dec [" vin" ])
1018
1018
signedtx = wallet .signrawtransactionwithwallet (fundedtx ['hex' ])
1019
- wallet .sendrawtransaction ( signedtx ['hex' ])
1019
+ assert wallet .testmempoolaccept ([ signedtx ['hex' ]])[ 0 ][ "allowed" ]
1020
1020
1021
1021
def test_22670 (self ):
1022
1022
# In issue #22670, it was observed that ApproximateBestSubset may
0 commit comments