aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSamuel Dobson <dobsonsa68@gmail.com>2021-07-18 19:55:53 +1200
committerSamuel Dobson <dobsonsa68@gmail.com>2021-07-18 20:07:52 +1200
commite8f85e0e86e92e583b8984455b7bf9d0a777578a (patch)
tree07b64bd78522a57d8f65c6731a7bf7a41f75f575 /src
parent0eea1dfe80259daa1fea2732f65a3172ca942e5a (diff)
parent8465978f235e2e43feb5dabe2a4d61026343b6ab (diff)
Merge bitcoin/bitcoin#22421: Make IsSegWitOutput return true for taproot outputs
8465978f235e2e43feb5dabe2a4d61026343b6ab Make IsSegWitOutput return true for taproot outputs (Pieter Wuille) Pull request description: This fixes a bug: currently `utxoupdatepsbt` will not fill in UTXO data for PSBTs spending taproot outputs. ACKs for top commit: achow101: Code Review ACK 8465978f235e2e43feb5dabe2a4d61026343b6ab jonatack: ACK 8465978f235e2e43feb5dabe2a4d61026343b6ab meshcollider: utACK 8465978f235e2e43feb5dabe2a4d61026343b6ab Tree-SHA512: 2f8f873450bef4b5a4ce5962a231297b386c6b1445e69ce5f36ab28eca7343be3a11bc09c38534b0f75e6f99ba15d78d3ba5d484f6c63e5a9775e1f3f55a74e0
Diffstat (limited to 'src')
-rw-r--r--src/script/sign.cpp21
1 files changed, 12 insertions, 9 deletions
diff --git a/src/script/sign.cpp b/src/script/sign.cpp
index 65276f641f..7864e690d8 100644
--- a/src/script/sign.cpp
+++ b/src/script/sign.cpp
@@ -612,15 +612,18 @@ bool IsSolvable(const SigningProvider& provider, const CScript& script)
bool IsSegWitOutput(const SigningProvider& provider, const CScript& script)
{
- std::vector<valtype> solutions;
- auto whichtype = Solver(script, solutions);
- if (whichtype == TxoutType::WITNESS_V0_SCRIPTHASH || whichtype == TxoutType::WITNESS_V0_KEYHASH || whichtype == TxoutType::WITNESS_UNKNOWN) return true;
- if (whichtype == TxoutType::SCRIPTHASH) {
- auto h160 = uint160(solutions[0]);
- CScript subscript;
- if (provider.GetCScript(CScriptID{h160}, subscript)) {
- whichtype = Solver(subscript, solutions);
- if (whichtype == TxoutType::WITNESS_V0_SCRIPTHASH || whichtype == TxoutType::WITNESS_V0_KEYHASH || whichtype == TxoutType::WITNESS_UNKNOWN) return true;
+ int version;
+ valtype program;
+ if (script.IsWitnessProgram(version, program)) return true;
+ if (script.IsPayToScriptHash()) {
+ std::vector<valtype> solutions;
+ auto whichtype = Solver(script, solutions);
+ if (whichtype == TxoutType::SCRIPTHASH) {
+ auto h160 = uint160(solutions[0]);
+ CScript subscript;
+ if (provider.GetCScript(CScriptID{h160}, subscript)) {
+ if (subscript.IsWitnessProgram(version, program)) return true;
+ }
}
}
return false;