From 948c0bb25f2cf10c00b87ffca050adbf1d3c151a Mon Sep 17 00:00:00 2001 From: automation Date: Tue, 21 Oct 2025 19:06:14 +0100 Subject: [PATCH] feat(mock): generate unique mock bolt11 invoice for createInvoice - Updated the createInvoice method to generate a unique mock bolt11 invoice using a hex string derived from the current time. This enhances the realism of the mock server's responses. --- .../main/java/xyz/tcheeric/phoenixd/mock/MockLnServer.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/phoenixd-mock/src/main/java/xyz/tcheeric/phoenixd/mock/MockLnServer.java b/phoenixd-mock/src/main/java/xyz/tcheeric/phoenixd/mock/MockLnServer.java index 1b8d905..9c0b2da 100644 --- a/phoenixd-mock/src/main/java/xyz/tcheeric/phoenixd/mock/MockLnServer.java +++ b/phoenixd-mock/src/main/java/xyz/tcheeric/phoenixd/mock/MockLnServer.java @@ -44,7 +44,10 @@ private void handlePayLightningAddress(HttpExchange exchange) throws IOException } private void handleCreateInvoice(HttpExchange exchange) throws IOException { - writeJson(exchange, "{\"amountSat\":10,\"paymentHash\":\"hash\",\"serialized\":\"invoice\"}"); + // Generate a unique mock bolt11 invoice + String invoiceId = Long.toHexString(System.nanoTime()); + String bolt11 = "lnbc1mock" + invoiceId; + writeJson(exchange, "{\"amountSat\":10,\"paymentHash\":\"hash" + invoiceId + "\",\"serialized\":\"" + bolt11 + "\"}"); } private void handleDecodeInvoice(HttpExchange exchange) throws IOException {