Repository navigation
Clarify psbt_parser.py docstrings and comments; minor cleanup - #1027
Merged
Merged
Conversation
No behavior change. Corrects prose that had drifted from what the code does, and addresses two local names for the same reason. Docstrings and comments: - The two ownership-claim exceptions state the condition each signals, without speculating about how it arises. - _get_seed_derivation_path drops the output-versus-input severity split, which _verify_claimed_derivation_paths already states. - The verified_*_derivation_paths comment says what an entry holds, and no longer explains the None the positive statement already implies. - parse() steps 1 and 2 name the per-key condition instead of "scopes". - _parse_inputs gains a docstring covering the amount total and the one-shared-policy requirement. - The single-sig branch comment names the script types it covers. Naming: - _parse_multisig's `sc` parameter becomes `multisig_script`. - A TODO marks _get_policy's local `script`, which shadows the embit module imported at the top of the file.
Chaitanya-Keyal
approved these changes
Aug 30, 2026
Chaitanya-Keyal
left a comment
Contributor
There was a problem hiding this comment.
ACK. Verified this is comments and one param rename only, and the comments look good.
"An output scope claims..." reads no better than "An output claims...". The word is doing no work in a sentence about what the output says, and the psbt-scope sense it borrows is not the one the reader needs there.
Contributor
Author
|
Two more trivial edits in 8574c13 |
|
ACK. I too have read this as no functional changes; comment improvements and a better varname for an internal method. |
Collaborator
|
ACK |
6 of 18 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Clarification and cleanup after #1013 and before the next planned PR in the sequence.
Some docstrings were unnecessarily over-explaining or re-explaining things that were covered elsewhere.
Other comments were rewritten to be easier to understand and/or trim unnecessary terminology.
No behavior changes.
Summary by Claude:
Docstrings and comments
PSBTOutputOwnershipClaimErrorandPSBTInputOwnershipClaimErroreach now state the condition they signal. Both drop prose speculating about how that condition arises in practice; the concrete cases already have tests with real fixtures, including a brute-forced colliding fingerprint pair._get_seed_derivation_path. Drops a restatement of the output-versus-input severity split._verify_claimed_derivation_pathsalready gives it, in the function that orders the two and therefore owns that policy.verified_input_derivation_paths/verified_output_derivation_paths. The comment says what an entry holds. It no longer explains theNonecase, which the positive statement already implies.parse()steps 1 and 2. Step 1 said "scopes the seed provably derives", but the check is per key, so it now says so. Step 2 drops a redundant "scope" and states the raise more directly._parse_inputs. Gains a docstring. It was undocumented, and the fact that it raisesRuntimeErrorunless every input resolves to the same policy was recorded only inparse()'s summary.Naming
_parse_multisig. Thescparameter becomesmultisig_script, matching what both call sites already name it. Module-local, not part of any public signature._get_policy. ATODOmarking its localscriptvariable, which shadows thescriptmodule imported at the top of the file. It is harmless today only because nothing after that line needs the module. Left as a marker rather than renamed, since there is other in-flight work in this function and a one-line note survives a rebase more reliably than a rename.This pull request is categorized as a:
Checklist
I ran
pytestlocallyI included screenshots of any new or modified screens
Should be part of the PR description above.
I added or updated tests
Any new or altered functionality should be covered in a unit test. Any new or updated sequences require FlowTests.
I tested this PR hands-on on the following platform(s):
I have reviewed these notes:
Thank you! Please join our Devs' Telegram group to get more involved.