Skip to content

Commit 10bda5b

Browse files
authored
Merge pull request #56 from 398ja/release/0.1.4
feat(mock): generate unique mock bolt11 invoice for createInvoice
2 parents 9772eda + 948c0bb commit 10bda5b

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

phoenixd-mock/src/main/java/xyz/tcheeric/phoenixd/mock/MockLnServer.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,10 @@ private void handlePayLightningAddress(HttpExchange exchange) throws IOException
4444
}
4545

4646
private void handleCreateInvoice(HttpExchange exchange) throws IOException {
47-
writeJson(exchange, "{\"amountSat\":10,\"paymentHash\":\"hash\",\"serialized\":\"invoice\"}");
47+
// Generate a unique mock bolt11 invoice
48+
String invoiceId = Long.toHexString(System.nanoTime());
49+
String bolt11 = "lnbc1mock" + invoiceId;
50+
writeJson(exchange, "{\"amountSat\":10,\"paymentHash\":\"hash" + invoiceId + "\",\"serialized\":\"" + bolt11 + "\"}");
4851
}
4952

5053
private void handleDecodeInvoice(HttpExchange exchange) throws IOException {

0 commit comments

Comments
 (0)