mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-02 09:46:52 -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)
|
||||
{
|
||||
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;
|
||||
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::SCRIPTHASH) {
|
||||
auto h160 = uint160(solutions[0]);
|
||||
CScript subscript;
|
||||
if (provider.GetCScript(CScriptID{h160}, subscript)) {
|
||||
if (subscript.IsWitnessProgram(version, program)) return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
|
Loading…
Add table
Reference in a new issue