From ebff2e92e4ab29facac5f27f0aebfbdddbe098ec Mon Sep 17 00:00:00 2001 From: Spencer Rhodes <79768179+libertas-primordium@users.noreply.github.com> Date: Fri, 29 May 2026 15:22:17 -0600 Subject: [PATCH] Use backend invoice payment hash for settlement checks Store the payment hash returned by the Lightning backend when creating a pending LNURL purchase session instead of always storing the locally generated preimage hash. This fixes phoenixd-backed payment reconciliation because phoenixd creates invoices with its own payment hash while Europa previously stored the generated preimage hash and then polled phoenixd for a hash it did not recognize. Validated with pnpm install --frozen-lockfile, pnpm build, and pnpm test. Also validated on a live phoenixd-backed Europa node: after this change, a 100 sat Lightning purchase increased phoenixd balance, the session changed from pending to active automatically, and the WireGuard peer was added without manual database or wg intervention. --- src/routes/lnurl.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/routes/lnurl.ts b/src/routes/lnurl.ts index 0f16a30..ed405a1 100644 --- a/src/routes/lnurl.ts +++ b/src/routes/lnurl.ts @@ -191,7 +191,10 @@ export function registerLnurlRoutes(app: FastifyInstance, deps: LnurlRouteDeps): status: 'pending', last_rx_counter: 0, last_tx_counter: 0, - payment_hash: paymentHash, + // Store the payment hash from the backend-created invoice. + // Phoenixd returns its own invoice payment hash; settlement polling + // must check the hash for the actual payable invoice. + payment_hash: invoice.paymentHash || paymentHash, listing_d_tag: deps.config.listing.d_tag, });