aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAndrew Chow <achow101-github@achow101.com>2022-07-11 14:21:46 -0400
committerAndrew Chow <achow101-github@achow101.com>2022-07-11 18:08:32 -0400
commitd2ed97656bba050051cfc677f1fa7eb3fc633f7d (patch)
treeec3c8f696968f2f94315a315b17d45385369e125 /test
parent0817cc379f6b4c65311a682fdc7c6b204aa6a7df (diff)
wallet: Precompute Txdata after setting PSBT inputs' UTXOs
If we are given a PSBT that is missing one or more input UTXOs, our PrecomputedTransactionData will be incorrect and missing information that it should otherwise have, and therefore we may not produce a signature when we should. To avoid this problem, we can do the precomputation after we have set the UTXOs the wallet is able to set for the PSBT. Also adds a test for this behavior.
Diffstat (limited to 'test')
-rwxr-xr-xtest/functional/rpc_psbt.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/functional/rpc_psbt.py b/test/functional/rpc_psbt.py
index d2a888fd31..9d35d797e0 100755
--- a/test/functional/rpc_psbt.py
+++ b/test/functional/rpc_psbt.py
@@ -21,6 +21,7 @@ from test_framework.util import (
assert_greater_than,
assert_raises_rpc_error,
find_output,
+ find_vout_for_address,
)
from test_framework.wallet_util import bytes_to_wif
@@ -764,5 +765,15 @@ class PSBTTest(BitcoinTestFramework):
psbt = self.nodes[0].walletprocesspsbt(psbt)["psbt"]
self.nodes[0].sendrawtransaction(self.nodes[0].finalizepsbt(psbt)["hex"])
+ self.log.info("Test that walletprocesspsbt both updates and signs a non-updated psbt containing Taproot inputs")
+ addr = self.nodes[0].getnewaddress("", "bech32m")
+ txid = self.nodes[0].sendtoaddress(addr, 1)
+ vout = find_vout_for_address(self.nodes[0], txid, addr)
+ psbt = self.nodes[0].createpsbt([{"txid": txid, "vout": vout}], [{self.nodes[0].getnewaddress(): 0.9999}])
+ signed = self.nodes[0].walletprocesspsbt(psbt)
+ rawtx = self.nodes[0].finalizepsbt(signed["psbt"])["hex"]
+ self.nodes[0].sendrawtransaction(rawtx)
+ self.generate(self.nodes[0], 1)
+
if __name__ == '__main__':
PSBTTest().main()