This fixes a bug: currently utxoupdatepsbt will not fill in UTXO data for PSBTs spending taproot outputs.
Make IsSegWitOutput return true for taproot outputs #22421
pull sipa wants to merge 1 commits into bitcoin:master from sipa:202107_taproot_is_segwit changing 1 files +12 −9-
sipa commented at 5:00 PM on July 9, 2021: member
-
sipa commented at 5:00 PM on July 9, 2021: member
Noticed by @roconnor-blockstream.
-
Xekyo commented at 5:11 PM on July 9, 2021: member
Concept ACK
-
in src/script/sign.cpp:617 in e3e05948c1 outdated
613 | @@ -614,7 +614,10 @@ bool IsSegWitOutput(const SigningProvider& provider, const CScript& script) 614 | { 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::WITNESS_V0_SCRIPTHASH ||
MarcoFalke commented at 5:28 AM on July 10, 2021:nit: Maybe turn this into a switch-case to get compiler output when v2 is added, but this isn't updated?
MarcoFalke commented at 8:51 AM on July 15, 2021:@sipa Are you still working on this? Happy to take over if not.
MarcoFalke approvedMarcoFalke added this to the milestone 22.0 on Jul 10, 2021laanwj commented at 8:13 AM on July 12, 2021: memberACK, but I like @MarcoFalke's suggestion to make the compiler complain about an uncovered case in case more enum items are added in the future, and this function is not updated.
GeneFerneau commented at 7:07 PM on July 15, 2021: noneConcept + review ACK e3e0594
Make IsSegWitOutput return true for taproot outputs 8465978f23sipa force-pushed on Jul 16, 2021sipa commented at 12:09 AM on July 16, 2021: memberI took another approach, and made it us
IsWitnessPrograminstead of trying to match against all variations that now exist as output fromSolver.in src/script/sign.cpp:625 in 8465978f23
629 | + auto whichtype = Solver(script, solutions); 630 | + if (whichtype == TxoutType::SCRIPTHASH) { 631 | + auto h160 = uint160(solutions[0]); 632 | + CScript subscript; 633 | + if (provider.GetCScript(CScriptID{h160}, subscript)) { 634 | + if (subscript.IsWitnessProgram(version, program)) return true;
achow101 commented at 12:15 AM on July 16, 2021:This would return true for Taproot scripts that are in the P2SH even though such scripts cannot be spent. Do we want to do that?
sipa commented at 12:19 AM on July 16, 2021:Yes, I noticed that, but I think my answer is yes. It also used to return true for unknown witness versions, so no reason to exclude v1 p2sh. It's still segwit; just not taproot.
fanquake deleted a comment on Jul 16, 2021achow101 commented at 6:32 PM on July 16, 2021: memberCode Review ACK 8465978f235e2e43feb5dabe2a4d61026343b6ab
jonatack commented at 7:32 PM on July 16, 2021: memberACK 8465978f235e2e43feb5dabe2a4d61026343b6ab
Could this use test coverage?
meshcollider added the label Wallet on Jul 18, 2021meshcollider commented at 7:35 AM on July 18, 2021: contributorutACK 8465978f235e2e43feb5dabe2a4d61026343b6ab
meshcollider merged this on Jul 18, 2021meshcollider closed this on Jul 18, 2021sidhujag referenced this in commit ff3a8f5415 on Jul 23, 2021roconnor-blockstream referenced this in commit 3c2c27ddf0 on Jul 25, 2021gwillen referenced this in commit b387aac530 on Jun 1, 2022DrahtBot locked this on Aug 18, 2022LabelsMilestone
22.0
This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-19 09:14 UTC
More mirrored repositories can be found on mirror.b10c.me