aboutsummaryrefslogtreecommitdiff
path: root/test/functional/rpc_fundrawtransaction.py
diff options
context:
space:
mode:
authorAndrew Chow <achow101-github@achow101.com>2019-11-22 22:21:36 -0500
committerAndrew Chow <achow101-github@achow101.com>2019-11-26 13:02:46 -0500
commiteadd1304c81e0b89178e4cc7630bd31650850c85 (patch)
tree5ef912f7e46c08e24d332d8aadf2f7346ab2cfc5 /test/functional/rpc_fundrawtransaction.py
parentff330badd45067cb520b1cfa1844f60a4c9f2031 (diff)
tests: Add a test for funding with sufficient preset inputs and subtractFeeFromOutputs
Diffstat (limited to 'test/functional/rpc_fundrawtransaction.py')
-rwxr-xr-xtest/functional/rpc_fundrawtransaction.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/functional/rpc_fundrawtransaction.py b/test/functional/rpc_fundrawtransaction.py
index 693051edc0..6f1ae0d3ba 100755
--- a/test/functional/rpc_fundrawtransaction.py
+++ b/test/functional/rpc_fundrawtransaction.py
@@ -92,6 +92,7 @@ class RawTransactionsTest(BitcoinTestFramework):
self.test_option_feerate()
self.test_address_reuse()
self.test_option_subtract_fee_from_outputs()
+ self.test_subtract_fee_with_presets()
def test_change_position(self):
"""Ensure setting changePosition in fundraw with an exact match is handled properly."""
@@ -741,5 +742,17 @@ class RawTransactionsTest(BitcoinTestFramework):
# The total subtracted from the outputs is equal to the fee.
assert_equal(share[0] + share[2] + share[3], result[0]['fee'])
+ def test_subtract_fee_with_presets(self):
+ self.log.info("Test fundrawtxn subtract fee from outputs with preset inputs that are sufficient")
+
+ addr = self.nodes[0].getnewaddress()
+ txid = self.nodes[0].sendtoaddress(addr, 10)
+ vout = find_vout_for_address(self.nodes[0], txid, addr)
+
+ rawtx = self.nodes[0].createrawtransaction([{'txid': txid, 'vout': vout}], [{self.nodes[0].getnewaddress(): 5}])
+ fundedtx = self.nodes[0].fundrawtransaction(rawtx, {'subtractFeeFromOutputs': [0]})
+ signedtx = self.nodes[0].signrawtransactionwithwallet(fundedtx['hex'])
+ self.nodes[0].sendrawtransaction(signedtx['hex'])
+
if __name__ == '__main__':
RawTransactionsTest().main()