diff options
author | Andrew Chow <achow101-github@achow101.com> | 2021-08-26 20:32:18 -0400 |
---|---|---|
committer | Andrew Chow <achow101-github@achow101.com> | 2021-09-09 15:07:43 -0400 |
commit | a165bfbe44b4db3a40b8d1ba8095035367c932a7 (patch) | |
tree | b29373f9af14395427b879e87c5084d3147560fc /test/functional/rpc_fundrawtransaction.py | |
parent | df765a484d84702f066e127813fa45a7d440a957 (diff) | |
download | bitcoin-a165bfbe44b4db3a40b8d1ba8095035367c932a7.tar.xz |
tests: rpc_fundrawtx use specific inputs for unavailable change test
For the test that checks that there is no error when change is
unavailable but change is also not needed, use specific UTXOs so that
SRD does not cause this to fail when it chooses random inputs.
Diffstat (limited to 'test/functional/rpc_fundrawtransaction.py')
-rwxr-xr-x | test/functional/rpc_fundrawtransaction.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/test/functional/rpc_fundrawtransaction.py b/test/functional/rpc_fundrawtransaction.py index 17102f84d4..5264e501e0 100755 --- a/test/functional/rpc_fundrawtransaction.py +++ b/test/functional/rpc_fundrawtransaction.py @@ -587,15 +587,18 @@ class RawTransactionsTest(BitcoinTestFramework): # Drain the keypool. self.nodes[1].getnewaddress() self.nodes[1].getrawchangeaddress() - inputs = [] - outputs = {self.nodes[0].getnewaddress():1.19999500} + + # Choose 2 inputs + inputs = self.nodes[1].listunspent()[0:2] + value = sum(inp["amount"] for inp in inputs) - Decimal("0.00000500") # Pay a 500 sat fee + outputs = {self.nodes[0].getnewaddress():value} rawtx = self.nodes[1].createrawtransaction(inputs, outputs) # fund a transaction that does not require a new key for the change output self.nodes[1].fundrawtransaction(rawtx) # fund a transaction that requires a new key for the change output # creating the key must be impossible because the wallet is locked - outputs = {self.nodes[0].getnewaddress():1.1} + outputs = {self.nodes[0].getnewaddress():value - Decimal("0.1")} rawtx = self.nodes[1].createrawtransaction(inputs, outputs) assert_raises_rpc_error(-4, "Transaction needs a change address, but we can't generate it.", self.nodes[1].fundrawtransaction, rawtx) |