0
0
Fork 0
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 ACK 8465978f23
  jonatack:
    ACK 8465978f23
  meshcollider:
    utACK 8465978f23

Tree-SHA512: 2f8f873450bef4b5a4ce5962a231297b386c6b1445e69ce5f36ab28eca7343be3a11bc09c38534b0f75e6f99ba15d78d3ba5d484f6c63e5a9775e1f3f55a74e0
This commit is contained in:
Samuel Dobson 2021-07-18 19:55:53 +12:00
commit e8f85e0e86
No known key found for this signature in database
GPG key ID: D300116E1C875A3D

View file

@ -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;