WIP: Add BOLT12 payer proof support#845
WIP: Add BOLT12 payer proof support#845vincenzopalazzo wants to merge 6 commits intolightningdevkit:mainfrom
Conversation
|
👋 Thanks for assigning @tnull as a reviewer! |
18e0c72 to
312b662
Compare
312b662 to
4e593b7
Compare
781d3ee to
0aaab83
Compare
|
🔔 1st Reminder Hey @tnull! This PR has been waiting for your review. |
|
🔔 2nd Reminder Hey @tnull! This PR has been waiting for your review. |
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add payer-proof creation for outbound BOLT12 payments, persist the invoice context needed to build the proof, and expose the new types through the public and UniFFI surfaces. AI-assisted-by: Codex
Update rust-lightning dependency to include commits from PRs #4210 (BLIP-42 contact secrets) and #4297 (payment_nonce in PaymentSent). The payment_nonce in PaymentSent allows capturing the nonce needed for payer proof construction directly from the payment success event, eliminating the need to set manually_handle_bolt12_invoices and intercept InvoiceReceived. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Use cfg-gated match to extract Bolt12Invoice correctly per build mode: non-uniffi uses PaidBolt12Invoice::Bolt12Invoice variant, uniffi uses PaidBolt12Invoice::Bolt12 variant and unwraps Arc + inner - Apply cargo fmt to fix formatting diffs - Remove redundant .clone() in PayerProofContext construction Co-Authored-By: Claude <noreply@anthropic.com>
- Bump rust-lightning rev from f5c24c6 to c836395 - PaidBolt12Invoice changed from enum (lightning::events) to struct (lightning::offers::payer_proof) - New Bolt12InvoiceType enum replaces old PaidBolt12Invoice variants - OptionalOfferPaymentParams lost contact_secrets/payer_offer fields - PayerProofContextStore is now in-memory only since PaidBolt12Invoice cannot be serialized or reconstructed externally (new/nonce/invoice_type are all pub(crate) in LDK) - Removed payment_nonce field from Event::PaymentSuccessful - Removed read_payer_proof_contexts and related persistence constants - cfg-gated Bolt12InvoiceType vs FFI PaidBolt12Invoice for uniffi compat Co-authored-by: AI Assistant <ai@lightningdevkit.org>
26899ae to
a0641a2
Compare
| (3, quantity, option), | ||
| (4, secret, option), | ||
| (6, offer_id, required), | ||
| (8, bolt12_invoice, option), |
There was a problem hiding this comment.
As mentioned elsewhere, we probably don't want to do this, at least not before we can use #811
| scorer: Arc<Mutex<Scorer>>, | ||
| peer_store: Arc<PeerStore<Arc<Logger>>>, | ||
| payment_store: Arc<PaymentStore>, | ||
| payer_proof_context_store: Arc<PayerProofContextStore>, |
There was a problem hiding this comment.
No, I'd rather not add yet another store just for this. Can we store this in the payment metadata store post #811?
There was a problem hiding this comment.
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 :)
The previous CI run had a flaky failure in test async_payment on ubuntu-latest/1.85.0 due to a BrokenPipe in block header subscription (tests/common/mod.rs:541), which is a race condition in the test infrastructure unrelated to our changes. The semver-checks failure is expected: it compares the published crate against our PR which patches LDK to a different fork revision, causing type mismatches in NetworkGraph/OnionMessenger. This will resolve once the upstream rust-lightning PR #4297 merges. Generated with AI assistance.
Summary
InvoiceReceivedand exposeBolt12Payment::create_payer_proofwith selective disclosure optionsVerification
Disclosure
Please note that this PR is just a test to see if we are adding all the necessary API to the main PR lightningdevkit/rust-lightning#4297