File tree Expand file tree Collapse file tree 1 file changed +12
-9
lines changed Expand file tree Collapse file tree 1 file changed +12
-9
lines changed Original file line number Diff line number Diff line change @@ -612,15 +612,18 @@ bool IsSolvable(const SigningProvider& provider, const CScript& script)
612612
613613bool 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 ;
You can’t perform that action at this time.
0 commit comments