From f624ced5ce324afbd8fcfefb359862d7e00f80a9 Mon Sep 17 00:00:00 2001 From: Mike Fluff Date: Wed, 6 Mar 2019 11:27:40 +0700 Subject: [PATCH] Fix with null result TXs fetcher --- class/User.js | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/class/User.js b/class/User.js index a2b62e0..5720ff4 100644 --- a/class/User.js +++ b/class/User.js @@ -282,13 +282,14 @@ export class User { let txs = await this._bitcoindrpc.request('listtransactions', [addr, 100500, 0, true]); txs = txs.result; let result = []; - for (let tx of txs) { - if (tx.confirmations >= 3) { - tx.type = 'bitcoind_tx'; - result.push(tx); + if(!txs===null) { + for (let tx of txs) { + if (tx.confirmations >= 3) { + tx.type = 'bitcoind_tx'; + result.push(tx); + } } } - let range = await this._redis.lrange('txs_for_' + this._userid, 0, -1); for (let invoice of range) { invoice = JSON.parse(invoice); @@ -311,9 +312,7 @@ export class User { delete invoice.payment_route; delete invoice.pay_req; delete invoice.decoded; - result.push(invoice); } - return result; } @@ -332,9 +331,11 @@ export class User { let txs = await this._bitcoindrpc.request('listtransactions', [addr, 100500, 0, true]); txs = txs.result; let result = []; - for (let tx of txs) { - if (tx.confirmations < 3) { - result.push(tx); + if(!txs === null) { + for (let tx of txs) { + if (tx.confirmations < 3) { + result.push(tx); + } } } return result;