mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-02 09:46:52 -05:00
Make IsSegWitOutput return true for taproot outputs
This commit is contained in:
parent
a88fa1a555
commit
8465978f23
1 changed files with 12 additions and 9 deletions
|
@ -612,15 +612,18 @@ bool IsSolvable(const SigningProvider& provider, const CScript& script)
|
|||
|
||||
bool IsSegWitOutput(const SigningProvider& provider, const CScript& script)
|
||||
{
|
||||
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::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;
|
||||
if (subscript.IsWitnessProgram(version, program)) return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
|
Loading…
Add table
Reference in a new issue