Skip to content
This repository has been archived by the owner on Jul 15, 2022. It is now read-only.

Commit

Permalink
fix tx pagination logic
Browse files Browse the repository at this point in the history
  • Loading branch information
hzheng-ledger committed Nov 3, 2021
1 parent 8304275 commit 5c5a6e1
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/families/bitcoin/wallet-btc/xpub.ts
Original file line number Diff line number Diff line change
Expand Up @@ -430,9 +430,11 @@ class Xpub extends EventEmitter {
{ address, account, index },
lastTx
);
pendingTxs = pendingTxs.concat(txs.filter((tx) => !tx.block));
if (pendingTxs.length === 0) {
pendingTxs = txs.filter((tx) => !tx.block);
}
inserted += await this.storage.appendTxs(txs.filter((tx) => tx.block)); // only insert not pending tx
} while (txs.length >= this.txsSyncArraySize); // check whether page is full, if not, it is the last page
} while (txs.length - pendingTxs.length >= this.txsSyncArraySize); // check whether page is full, if not, it is the last page
inserted += await this.storage.appendTxs(pendingTxs);
return inserted;
}
Expand Down

0 comments on commit 5c5a6e1

Please sign in to comment.