Skip to content

Commit a16a4af

Browse files
Merge pull request #51 from TheBlueMatt/2021-07-fix-units
Fix units in Java Invoice parsing sample
2 parents b4ec301 + 85f3784 commit a16a4af

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

docs/using_ldk.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -358,11 +358,11 @@ Result_InvoiceNoneZ parsed_invoice = Invoice.from_str(invoice_str);
358358

359359
if (parsed_invoice instanceof Result_InvoiceNoneZ.Result_InvoiceNoneZ_OK) {
360360
Invoice invoice = ((Result_InvoiceNoneZ.Result_InvoiceNoneZ_OK) parsed_invoice).res;
361-
long amt = 0;
361+
long amt_msat = 0;
362362
if (invoice.amount_pico_btc() instanceof Option_u64Z.Some) {
363-
amt = ((Option_u64Z.Some)invoice.amount_pico_btc()).some;
363+
amt_msat = ((Option_u64Z.Some)invoice.amount_pico_btc()).some / 10;
364364
}
365-
if (amt == 0) {
365+
if (amt_msat == 0) {
366366
// <Handle a zero-value invoice>
367367
}
368368

@@ -372,8 +372,8 @@ if (parsed_invoice instanceof Result_InvoiceNoneZ.Result_InvoiceNoneZ_OK) {
372372
Result_RouteLightningErrorZ route_res = UtilMethods.get_route(
373373
channel_manager.get_our_node_id(),
374374
graph, invoice.recover_payee_pub_key(), invoice.features(),
375-
channel_manager.list_usable_channels(), invoice.route_hints(), amt,
376-
invoice.min_final_cltv_expiry(), logger);
375+
channel_manager.list_usable_channels(), invoice.route_hints(),
376+
amt_msat, invoice.min_final_cltv_expiry(), logger);
377377
assert route_res instanceof Result_RouteLightningErrorZ.Result_RouteLightningErrorZ_OK;
378378
route = ((Result_RouteLightningErrorZ.Result_RouteLightningErrorZ_OK) route_res).res;
379379
}

0 commit comments

Comments
 (0)