Skip to content

Conversation

@martinsaposnic
Copy link
Contributor

Summary

  • Add wait_for_payment_secs parameter to pay_bolt12_offer to keep the node alive during the async Bolt12 flow
  • Add debug logging for troubleshooting Bolt12 payments

Context

Bolt12 payments are async - the node sends an invoice request via onion message, waits for the invoice response, then pays. Without waiting, the node shuts down immediately after initiating, before the flow can complete.

This mirrors the existing wait_for_payment_secs behavior in pay_lnurl.

Test plan

  • Test Bolt12 payment with wait_for_payment_secs set to 30-60 seconds
  • Verify debug logs show the full payment flow

Bolt12 payments are async - the node sends an invoice request via onion
message, waits for the invoice response, then pays. Without waiting, the
node shuts down before the flow completes.

This adds the same wait_for_payment_secs parameter that pay_lnurl uses,
plus additional debug logging for troubleshooting.
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 86c2a27482

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines 934 to +937
&self,
bolt12_offer_string: String,
amount_msat: i64,
wait_for_payment_secs: Option<i64>,

Choose a reason for hiding this comment

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

P2 Badge Update TypeScript definition for new wait param

The N-API signature now accepts wait_for_payment_secs, but the shipped TypeScript declarations still expose payBolt12Offer(bolt12OfferString, amountMsat) only (see index.d.ts). That means TS consumers cannot pass the new wait value without type errors, so the new behavior is effectively unusable for typed callers and will break builds that add the third argument. Please regenerate or update index.d.ts to include an optional waitForPaymentSecs?: number for this method.

Useful? React with 👍 / 👎.

@martinsaposnic martinsaposnic merged commit cef104e into main Jan 7, 2026
0 of 11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants