Fix with null result TXs fetcher

This commit is contained in:
Mike Fluff 2019-03-06 11:27:40 +07:00
parent 27ebe36b4b
commit f624ced5ce

View File

@ -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;