Skip to content

chore: remove stale TODO, HTLC pubkey signing already wired up#979

Open
KvngMikey wants to merge 2 commits intocashubtc:mainfrom
KvngMikey:htlc_sig
Open

chore: remove stale TODO, HTLC pubkey signing already wired up#979
KvngMikey wants to merge 2 commits intocashubtc:mainfrom
KvngMikey:htlc_sig

Conversation

@KvngMikey
Copy link
Copy Markdown
Contributor

Fixes #955

Summary

The TODO comment on line 339 of wallet_p2pk.py:

# TODO: Sign HTLCs that require signatures as well

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_inputs explicitly collects HTLC proofs that carry a pubkeys or refund tag. These pass the SIG_INPUTS sigflag filter because P2PKSecret.deserialize reads tags without checking kind, and sigflag defaults to SIG_INPUTS when no explicit tag is present. filter_proofs_locked_to_our_pubkey then finds our key in the pubkeys/refund tags. Finally, add_signatures_to_proofs handles the HTLC branch by deserializing the existing witness, preserving the preimage, and appending the new signature.

Changes

  • Removed the stale TODO comment
  • Added test_htlc_redeem_with_automatic_signature to confirm the wallet auto-signs an HTLC proof with a pubkey lock end-to-end, without the caller manually building the full witness.

Copilot AI review requested due to automatic review settings April 13, 2026 08:31
@github-project-automation github-project-automation bot moved this to Backlog in nutshell Apr 13, 2026
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy link
Copy Markdown

codecov bot commented Apr 13, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 75.17%. Comparing base (f32a6ce) to head (68c4287).
✅ All tests successful. No failed tests found.

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.
📢 Have feedback on the report? Share it here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

Todo: HTLC signature

2 participants