From ec9a71f4e9ae60184f3a26e4bd53a8e8a70e90ae Mon Sep 17 00:00:00 2001 From: Overtorment Date: Fri, 24 Jan 2020 00:19:27 +0000 Subject: [PATCH] FIX: account for msats in /payinvoice --- class/User.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/class/User.js b/class/User.js index 60a4448..7002b94 100644 --- a/class/User.js +++ b/class/User.js @@ -317,6 +317,10 @@ export class User { if (invoice.payment_route) { invoice.fee = +invoice.payment_route.total_fees; invoice.value = +invoice.payment_route.total_fees + +invoice.payment_route.total_amt; + if (invoice.payment_route.total_amt_msat && invoice.payment_route.total_amt_msat / 1000 !== +invoice.payment_route.total_amt) { + // okay, we have to account for MSAT + invoice.value = Math.max(parseInt(invoice.payment_route.total_amt_msat / 1000), +invoice.payment_route.total_amt) + 1; // extra sat to cover for msats, as external layer (clients) dont have that resolution + } } else { invoice.fee = 0; }