-
Notifications
You must be signed in to change notification settings - Fork 37.7k
psbt: AnalyzePSBT set next to"finalizer" when all inputs need finalizing #18220
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Can you explain the code path master is hitting? Mind sharing the PSBT? :) |
Just try with a ColdCard simulator, it's pretty reproducible. On master The reason master doesn't check |
If it's really easy to set up I think a checked in test is in order |
…zing Previously the next step would be SIGNER if all of the inputs had FINALIZER as their next step.
a4cdad9
to
64a44dc
Compare
I added a test. |
I had such trouble understanding the function I decided a proper refactor of logic was in order: #18224 |
1ef28b4 Make AnalyzePSBT next role calculation simple, correct (Gregory Sanders) Pull request description: Sniped test and alternative to #18220 Sjors documenting the issue: ``` A PSBT signed by ColdCard was analyzed as follows (see #17509 (comment)) { "inputs": [ { "has_utxo": true, "is_final": false, "next": "finalizer" } ], "estimated_vsize": 141, "estimated_feerate": 1e-05, "fee": 1.41e-06, "next": "signer" } I changed AnalyzePSBT so that it returns "next": "finalizer" instead. ``` It makes it much clearer that the role has been decided before hitting the `calc_fee` block, and groups all state-deciding in one spot instead of 2. Note that this assumes that PSBT roles are a complete ordering, which for now and in the future seems to be a correct assumption. ACKs for top commit: Sjors: ACK 1ef28b4, much nicer. Don't forget to document the bug fix. achow101: ACK 1ef28b4 Empact: ACK 1ef28b4 Tree-SHA512: 22ba4234985c6f9c1445b14565c71268cfaa121c4ef000ee3d5117212b09442dee8d46d9701bceddaf355263fe25dfe40def2ef614d4f2fe66c9ce876cb49934
…orrect 1ef28b4 Make AnalyzePSBT next role calculation simple, correct (Gregory Sanders) Pull request description: Sniped test and alternative to bitcoin#18220 Sjors documenting the issue: ``` A PSBT signed by ColdCard was analyzed as follows (see bitcoin#17509 (comment)) { "inputs": [ { "has_utxo": true, "is_final": false, "next": "finalizer" } ], "estimated_vsize": 141, "estimated_feerate": 1e-05, "fee": 1.41e-06, "next": "signer" } I changed AnalyzePSBT so that it returns "next": "finalizer" instead. ``` It makes it much clearer that the role has been decided before hitting the `calc_fee` block, and groups all state-deciding in one spot instead of 2. Note that this assumes that PSBT roles are a complete ordering, which for now and in the future seems to be a correct assumption. ACKs for top commit: Sjors: ACK 1ef28b4, much nicer. Don't forget to document the bug fix. achow101: ACK 1ef28b4 Empact: ACK bitcoin@1ef28b4 Tree-SHA512: 22ba4234985c6f9c1445b14565c71268cfaa121c4ef000ee3d5117212b09442dee8d46d9701bceddaf355263fe25dfe40def2ef614d4f2fe66c9ce876cb49934
…orrect 1ef28b4 Make AnalyzePSBT next role calculation simple, correct (Gregory Sanders) Pull request description: Sniped test and alternative to bitcoin#18220 Sjors documenting the issue: ``` A PSBT signed by ColdCard was analyzed as follows (see bitcoin#17509 (comment)) { "inputs": [ { "has_utxo": true, "is_final": false, "next": "finalizer" } ], "estimated_vsize": 141, "estimated_feerate": 1e-05, "fee": 1.41e-06, "next": "signer" } I changed AnalyzePSBT so that it returns "next": "finalizer" instead. ``` It makes it much clearer that the role has been decided before hitting the `calc_fee` block, and groups all state-deciding in one spot instead of 2. Note that this assumes that PSBT roles are a complete ordering, which for now and in the future seems to be a correct assumption. ACKs for top commit: Sjors: ACK 1ef28b4, much nicer. Don't forget to document the bug fix. achow101: ACK 1ef28b4 Empact: ACK bitcoin@1ef28b4 Tree-SHA512: 22ba4234985c6f9c1445b14565c71268cfaa121c4ef000ee3d5117212b09442dee8d46d9701bceddaf355263fe25dfe40def2ef614d4f2fe66c9ce876cb49934
A PSBT signed by ColdCard was analyzed as follows (see #17509 (comment))
I changed
AnalyzePSBT
so that it returns"next": "finalizer"
instead.