mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-08 10:31:50 -05:00
Merge bitcoin/bitcoin#22421: Make IsSegWitOutput return true for taproot outputs
8465978f23
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 ACK8465978f23
jonatack: ACK8465978f23
meshcollider: utACK8465978f23
Tree-SHA512: 2f8f873450bef4b5a4ce5962a231297b386c6b1445e69ce5f36ab28eca7343be3a11bc09c38534b0f75e6f99ba15d78d3ba5d484f6c63e5a9775e1f3f55a74e0
This commit is contained in:
commit
e8f85e0e86
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)
|
bool IsSegWitOutput(const SigningProvider& provider, const CScript& script)
|
||||||
{
|
{
|
||||||
std::vector<valtype> solutions;
|
int version;
|
||||||
auto whichtype = Solver(script, solutions);
|
valtype program;
|
||||||
if (whichtype == TxoutType::WITNESS_V0_SCRIPTHASH || whichtype == TxoutType::WITNESS_V0_KEYHASH || whichtype == TxoutType::WITNESS_UNKNOWN) return true;
|
if (script.IsWitnessProgram(version, program)) return true;
|
||||||
if (whichtype == TxoutType::SCRIPTHASH) {
|
if (script.IsPayToScriptHash()) {
|
||||||
auto h160 = uint160(solutions[0]);
|
std::vector<valtype> solutions;
|
||||||
CScript subscript;
|
auto whichtype = Solver(script, solutions);
|
||||||
if (provider.GetCScript(CScriptID{h160}, subscript)) {
|
if (whichtype == TxoutType::SCRIPTHASH) {
|
||||||
whichtype = Solver(subscript, solutions);
|
auto h160 = uint160(solutions[0]);
|
||||||
if (whichtype == TxoutType::WITNESS_V0_SCRIPTHASH || whichtype == TxoutType::WITNESS_V0_KEYHASH || whichtype == TxoutType::WITNESS_UNKNOWN) return true;
|
CScript subscript;
|
||||||
|
if (provider.GetCScript(CScriptID{h160}, subscript)) {
|
||||||
|
if (subscript.IsWitnessProgram(version, program)) return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Add table
Reference in a new issue