You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Adds support for building BOLT 12 payer proofs for previously succeeded outbound BOLT 12 payments:
Persist the paid BOLT 12 invoice on PaymentKind::Bolt12Offer / PaymentKind::Bolt12Refund, set from Event::PaymentSent once the payment succeeds.
Expose Bolt12Payment::create_payer_proof, which builds a payer proof from the persisted invoice and payment preimage. PayerProofOptions controls which optional invoice fields (offer description, issuer, amount, creation time, extra TLV types) are selectively disclosed, plus an optional proof note.
Wire the new PayerProof type and error variants (PayerProofCreationFailed, PayerProofUnavailable, InvalidPayerProof) through the UniFFI surface.
Since the proof is built purely from data persisted in the payment store, payer proofs survive restarts without any additional storage: no new KV namespace and no in-memory side store. Payments that completed via a static invoice (async payments) do not support payer proofs and are rejected with PayerProofUnavailable.
The payer proof primitives are already present in the rust-lightning revision we pin, so this PR does not patch LDK to a fork — Cargo.toml is untouched.
cargo clippy --lib -- -A warnings -D clippy::unwrap_used -A clippy::tabs_in_doc_comments
cargo test --lib, cargo test --test upgrade_downgrade_tests
cargo test --test integration_tests_rust simple_bolt12_send_receive — extended to build a payer proof from the persisted payment and assert the payment hash, disclosed amount, proof note, and that undisclosed fields stay absent
👋 Thanks for assigning @tnull as a reviewer!
I'll wait for their review and will help manage the review process.
Once they submit their review, I'll check if a second reviewer would be helpful.
Hey @tnull! This PR has been waiting for your review.
Please take a look when you have a chance. If you're unable to review, please let us know so we can find another reviewer.
Hey @tnull! This PR has been waiting for your review.
Please take a look when you have a chance. If you're unable to review, please let us know so we can find another reviewer.
The reason will be displayed to describe this comment to others. Learn more.
yes OFC, I wanted to have a runnable version in a fork, but currently I am interesting in you giving some feedback on the payer proof API, if you think are good enough!
Thanks after ldk 0.3 I can wait for #811 and vibe code another integration :)
Add a `bolt12_invoice` field to `PaymentKind::Bolt12Offer` and
`PaymentKind::Bolt12Refund`, and set it from `Event::PaymentSent` when a
BOLT 12 payment succeeds.
Besides being useful on its own, this gives us everything we need to
build a payer proof for a past payment without keeping any additional
state around: the invoice is persisted alongside the payment and thus
survives restarts.
This commit was written with AI assistance.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Expose `Bolt12Payment::create_payer_proof`, which builds a BOLT 12 payer
proof for a previously succeeded outbound BOLT 12 payment, with
`PayerProofOptions` controlling which optional invoice fields are
selectively disclosed.
The proof is built purely from data we already persist in the payment
store: the paid BOLT 12 invoice recorded on `PaymentKind::Bolt12Offer` /
`PaymentKind::Bolt12Refund` and the payment preimage. That means payer
proofs survive restarts and we don't need a second, node-lifetime-only
store to keep the invoice context around.
Payments that completed via a static invoice, i.e., async payments, don't
support payer proofs and are rejected with `PayerProofUnavailable`.
Also wires the new `PayerProof` type and the two new error variants
through the UniFFI surface.
This commit was written with AI assistance.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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
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.
Summary
Adds support for building BOLT 12 payer proofs for previously succeeded outbound BOLT 12 payments:
PaymentKind::Bolt12Offer/PaymentKind::Bolt12Refund, set fromEvent::PaymentSentonce the payment succeeds.Bolt12Payment::create_payer_proof, which builds a payer proof from the persisted invoice and payment preimage.PayerProofOptionscontrols which optional invoice fields (offer description, issuer, amount, creation time, extra TLV types) are selectively disclosed, plus an optional proof note.PayerProoftype and error variants (PayerProofCreationFailed,PayerProofUnavailable,InvalidPayerProof) through the UniFFI surface.Since the proof is built purely from data persisted in the payment store, payer proofs survive restarts without any additional storage: no new KV namespace and no in-memory side store. Payments that completed via a static invoice (async payments) do not support payer proofs and are rejected with
PayerProofUnavailable.The payer proof primitives are already present in the
rust-lightningrevision we pin, so this PR does not patch LDK to a fork —Cargo.tomlis untouched.Verification
cargo fmt --all -- --checkcargo check --lib --tests --benches,cargo check --lib --features unifficargo clippy --lib -- -A warnings -D clippy::unwrap_used -A clippy::tabs_in_doc_commentscargo test --lib,cargo test --test upgrade_downgrade_testscargo test --test integration_tests_rust simple_bolt12_send_receive— extended to build a payer proof from the persisted payment and assert the payment hash, disclosed amount, proof note, and that undisclosed fields stay absentscripts/uniffi_bindgen_generate_python.sh)Disclosure
This PR was prepared with AI assistance (Claude Code).
🤖 Generated with Claude Code