chore: remove stale TODO, HTLC pubkey signing already wired up#979
Open
KvngMikey wants to merge 2 commits intocashubtc:mainfrom
Open
chore: remove stale TODO, HTLC pubkey signing already wired up#979KvngMikey wants to merge 2 commits intocashubtc:mainfrom
KvngMikey wants to merge 2 commits intocashubtc:mainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
Removes a stale TODO implying HTLC pubkey-locked proofs aren’t auto-signed, and adds a regression test demonstrating HTLC redemption succeeds when the caller only provides the preimage (wallet supplies the signature).
Changes:
- Remove outdated TODO in
WalletP2PK.add_witnesses_sig_inputs. - Add an end-to-end wallet test for HTLC redemption with automatic signature handling.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| tests/wallet/test_wallet_htlc.py | Adds a new async test covering HTLC redemption where the wallet auto-appends the required signature. |
| cashu/wallet/p2pk.py | Removes a stale TODO comment now contradicted by existing HTLC signing logic. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #979 +/- ##
==========================================
+ Coverage 75.14% 75.17% +0.02%
==========================================
Files 99 99
Lines 11714 11714
==========================================
+ Hits 8803 8806 +3
+ Misses 2911 2908 -3 ☔ View full report in Codecov by Sentry. |
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.
Fixes #955
Summary
The TODO comment on line 339 of
wallet_p2pk.py:implied that HTLC proofs with pubkey locks weren't being signed automatically. They are, the TODO was written before this HTLC handling was added to those two methods. It was never removed.
sign_p2pk_sig_inputsexplicitly collects HTLC proofs that carry apubkeysorrefundtag. These pass theSIG_INPUTSsigflag filter becauseP2PKSecret.deserializereads tags without checkingkind, andsigflagdefaults toSIG_INPUTSwhen no explicit tag is present.filter_proofs_locked_to_our_pubkeythen finds our key in thepubkeys/refundtags. Finally,add_signatures_to_proofshandles the HTLC branch by deserializing the existing witness, preserving the preimage, and appending the new signature.Changes
test_htlc_redeem_with_automatic_signatureto confirm the wallet auto-signs an HTLC proof with a pubkey lock end-to-end, without the caller manually building the full witness.