From 496a1bbe5e442ffc0948f626cca1b85a46ef58db Mon Sep 17 00:00:00 2001 From: Andrew Chow Date: Mon, 26 Jul 2021 16:23:50 -0400 Subject: [PATCH] taproot: Use pre-existing signatures if available Actually use pre-existing signatures in CreateTaprootScriptSig if a signature is found for the given key and leaf hash. --- src/script/sign.cpp | 1 + test/functional/wallet_taproot.py | 3 +-- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/script/sign.cpp b/src/script/sign.cpp index 5cd773f6ee..12f2ec4d3a 100644 --- a/src/script/sign.cpp +++ b/src/script/sign.cpp @@ -150,6 +150,7 @@ static bool CreateTaprootScriptSig(const BaseSignatureCreator& creator, Signatur auto it = sigdata.taproot_script_sigs.find(lookup_key); if (it != sigdata.taproot_script_sigs.end()) { sig_out = it->second; + return true; } if (creator.CreateSchnorrSig(provider, sig_out, pubkey, &leaf_hash, nullptr, sigversion)) { sigdata.taproot_script_sigs[lookup_key] = sig_out; diff --git a/test/functional/wallet_taproot.py b/test/functional/wallet_taproot.py index d238c50bca..845953926b 100755 --- a/test/functional/wallet_taproot.py +++ b/test/functional/wallet_taproot.py @@ -442,8 +442,7 @@ class WalletTaprootTest(BitcoinTestFramework): assert(self.rpc_online.gettransaction(txid)["confirmations"] > 0) psbt = self.psbt_online.sendall(recipients=[self.boring.getnewaddress()], options={"psbt": True})["psbt"] - res = self.psbt_offline.walletprocesspsbt(psbt) - assert(res['complete']) + res = self.psbt_offline.walletprocesspsbt(psbt=psbt, finalize=False) rawtx = self.nodes[0].finalizepsbt(res['psbt'])['hex'] txid = self.nodes[0].sendrawtransaction(rawtx) self.generatetoaddress(self.nodes[0], 1, self.boring.getnewaddress(), sync_fun=self.no_op)