From e854626a457894142d4994740131e1b9763e9263 Mon Sep 17 00:00:00 2001 From: Overtorment Date: Mon, 21 Jan 2019 19:49:19 +0000 Subject: [PATCH] FIX: more strict balance check (re #8) --- class/User.js | 2 +- controllers/api.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/class/User.js b/class/User.js index dfd364d..732f25c 100644 --- a/class/User.js +++ b/class/User.js @@ -352,7 +352,7 @@ export class User { return; } - let userBalance = await this.getBalance(); + let userBalance = await this.getCalculatedBalance(); userBalance += new BigNumber(tx.amount).multipliedBy(100000000).toNumber(); await this.saveBalance(userBalance); await this._redis.rpush('imported_txids_for_' + this._userid, tx.txid); diff --git a/controllers/api.js b/controllers/api.js index f17b186..f47fe1c 100644 --- a/controllers/api.js +++ b/controllers/api.js @@ -120,7 +120,7 @@ router.post('/payinvoice', async function(req, res) { return errorTryAgainLater(res); } - let userBalance = await u.getBalance(); + let userBalance = await u.getCalculatedBalance(); lightning.decodePayReq({ pay_req: req.body.invoice }, async function(err, info) { if (err) {