From 1b78da1d7af7ec7749881a6ccfa53d248dbd12c4 Mon Sep 17 00:00:00 2001 From: archipelago Date: Tue, 21 Jul 2026 13:15:35 -0400 Subject: [PATCH] feat(lnd): accept amount_sats on lnd.payinvoice for zero-amount invoices Zero-amount BOLT11 invoices need the payer to supply the amount; forward it to LND REST as the amt field. The wallet scan modal unlocks its amount field for such invoices and passes the user's entry through. Co-Authored-By: Claude Fable 5 --- core/archipelago/src/api/rpc/lnd/payments.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/core/archipelago/src/api/rpc/lnd/payments.rs b/core/archipelago/src/api/rpc/lnd/payments.rs index 94e12090..276281bc 100644 --- a/core/archipelago/src/api/rpc/lnd/payments.rs +++ b/core/archipelago/src/api/rpc/lnd/payments.rs @@ -28,13 +28,20 @@ impl RpcHandler { )); } + // Zero-amount invoices need the amount supplied by the payer; LND's + // REST API takes it as an `amt` string alongside the payment request. + let amount_sats = params.get("amount_sats").and_then(|v| v.as_u64()); + info!("Paying Lightning invoice"); let (client, macaroon_hex) = self.lnd_client().await?; - let pay_body = serde_json::json!({ + let mut pay_body = serde_json::json!({ "payment_request": payment_request, }); + if let Some(amt) = amount_sats { + pay_body["amt"] = serde_json::json!(amt.to_string()); + } let resp = client .post(format!("{LND_REST_BASE_URL}/v1/channels/transactions"))