Skip to content

Commit 8465978

Browse files
committed
Make IsSegWitOutput return true for taproot outputs
1 parent a88fa1a commit 8465978

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)