Add wait_for_payment_secs to pay_bolt12_offer#3
Conversation
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.
There was a problem hiding this comment.
💡 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".
| &self, | ||
| bolt12_offer_string: String, | ||
| amount_msat: i64, | ||
| wait_for_payment_secs: Option<i64>, |
There was a problem hiding this comment.
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 👍 / 👎.
Added nativeNodeName mapping to determine correct NAPI-RS addon filename based on localSystem (x86_64-linux, aarch64-linux, x86_64-darwin, aarch64-darwin). This ensures Apple Silicon builds produce correctly named darwin-arm64.node files instead of being mislabeled as darwin-x64. Fixed musl builds failing with "target does not support cdylib": - Changed +crt-static to -crt-static for musl targets - Static CRT is incompatible with shared library (cdylib) output - Musl addons now dynamically link to musl.so Fixed cross/musl builds failing to find mold linker: - Added mold to nativeBuildInputs for mkCrossPackage - Changed CARGO_BUILD_RUSTFLAGS to RUSTFLAGS (priority #2) to override config.toml's target-specific flags (priority #3) - Include mold flag in RUSTFLAGS for musl/cross builds
Added nativeNodeName mapping to determine correct NAPI-RS addon filename based on localSystem (x86_64-linux, aarch64-linux, x86_64-darwin, aarch64-darwin). This ensures Apple Silicon builds produce correctly named darwin-arm64.node files instead of being mislabeled as darwin-x64. Fixed musl builds failing with "target does not support cdylib": - Changed +crt-static to -crt-static for musl targets - Static CRT is incompatible with shared library (cdylib) output - Musl addons now dynamically link to musl.so Fixed cross/musl builds failing to find mold linker: - Added mold to nativeBuildInputs for mkCrossPackage - Changed CARGO_BUILD_RUSTFLAGS to RUSTFLAGS (priority #2) to override config.toml's target-specific flags (priority #3) - Include mold flag in RUSTFLAGS for musl/cross builds
Added nativeNodeName mapping to determine correct NAPI-RS addon filename based on localSystem (x86_64-linux, aarch64-linux, x86_64-darwin, aarch64-darwin). This ensures Apple Silicon builds produce correctly named darwin-arm64.node files instead of being mislabeled as darwin-x64. Fixed musl builds failing with "target does not support cdylib": - Changed +crt-static to -crt-static for musl targets - Static CRT is incompatible with shared library (cdylib) output - Musl addons now dynamically link to musl.so Fixed cross/musl builds failing to find mold linker: - Added mold to nativeBuildInputs for mkCrossPackage - Changed CARGO_BUILD_RUSTFLAGS to RUSTFLAGS (priority #2) to override config.toml's target-specific flags (priority #3) - Include mold flag in RUSTFLAGS for musl/cross builds
Summary
wait_for_payment_secsparameter topay_bolt12_offerto keep the node alive during the async Bolt12 flowContext
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_secsbehavior inpay_lnurl.Test plan
wait_for_payment_secsset to 30-60 seconds