Skip to content

Commit e8f85e0

Browse files
committed
Merge bitcoin/bitcoin#22421: Make IsSegWitOutput return true for taproot outputs
8465978 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 8465978 jonatack: ACK 8465978 meshcollider: utACK 8465978 Tree-SHA512: 2f8f873450bef4b5a4ce5962a231297b386c6b1445e69ce5f36ab28eca7343be3a11bc09c38534b0f75e6f99ba15d78d3ba5d484f6c63e5a9775e1f3f55a74e0
2 parents 0eea1df + 8465978 commit e8f85e0

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

src/script/sign.cpp

+12-9
Original file line numberDiff line numberDiff line change
@@ -612,15 +612,18 @@ bool IsSolvable(const SigningProvider& provider, const CScript& script)
612612

613613
bool IsSegWitOutput(const SigningProvider& provider, const CScript& script)
614614
{
615-
std::vector<valtype> solutions;
616-
auto whichtype = Solver(script, solutions);
617-
if (whichtype == TxoutType::WITNESS_V0_SCRIPTHASH || whichtype == TxoutType::WITNESS_V0_KEYHASH || whichtype == TxoutType::WITNESS_UNKNOWN) return true;
618-
if (whichtype == TxoutType::SCRIPTHASH) {
619-
auto h160 = uint160(solutions[0]);
620-
CScript subscript;
621-
if (provider.GetCScript(CScriptID{h160}, subscript)) {
622-
whichtype = Solver(subscript, solutions);
623-
if (whichtype == TxoutType::WITNESS_V0_SCRIPTHASH || whichtype == TxoutType::WITNESS_V0_KEYHASH || whichtype == TxoutType::WITNESS_UNKNOWN) return true;
615+
int version;
616+
valtype program;
617+
if (script.IsWitnessProgram(version, program)) return true;
618+
if (script.IsPayToScriptHash()) {
619+
std::vector<valtype> solutions;
620+
auto whichtype = Solver(script, solutions);
621+
if (whichtype == TxoutType::SCRIPTHASH) {
622+
auto h160 = uint160(solutions[0]);
623+
CScript subscript;
624+
if (provider.GetCScript(CScriptID{h160}, subscript)) {
625+
if (subscript.IsWitnessProgram(version, program)) return true;
626+
}
624627
}
625628
}
626629
return false;

0 commit comments

Comments
 (0)