@@ -92,6 +92,7 @@ def run_test(self):
92
92
self .test_option_feerate ()
93
93
self .test_address_reuse ()
94
94
self .test_option_subtract_fee_from_outputs ()
95
+ self .test_subtract_fee_with_presets ()
95
96
96
97
def test_change_position (self ):
97
98
"""Ensure setting changePosition in fundraw with an exact match is handled properly."""
@@ -741,5 +742,17 @@ def test_option_subtract_fee_from_outputs(self):
741
742
# The total subtracted from the outputs is equal to the fee.
742
743
assert_equal (share [0 ] + share [2 ] + share [3 ], result [0 ]['fee' ])
743
744
745
+ def test_subtract_fee_with_presets (self ):
746
+ self .log .info ("Test fundrawtxn subtract fee from outputs with preset inputs that are sufficient" )
747
+
748
+ addr = self .nodes [0 ].getnewaddress ()
749
+ txid = self .nodes [0 ].sendtoaddress (addr , 10 )
750
+ vout = find_vout_for_address (self .nodes [0 ], txid , addr )
751
+
752
+ rawtx = self .nodes [0 ].createrawtransaction ([{'txid' : txid , 'vout' : vout }], [{self .nodes [0 ].getnewaddress (): 5 }])
753
+ fundedtx = self .nodes [0 ].fundrawtransaction (rawtx , {'subtractFeeFromOutputs' : [0 ]})
754
+ signedtx = self .nodes [0 ].signrawtransactionwithwallet (fundedtx ['hex' ])
755
+ self .nodes [0 ].sendrawtransaction (signedtx ['hex' ])
756
+
744
757
if __name__ == '__main__' :
745
758
RawTransactionsTest ().main ()
0 commit comments