Correctly error handle getTransaction and set 404 status when not found.

This commit is contained in:
softsimon
2021-01-24 02:51:22 +07:00
parent fb41f58f7c
commit 5b268794af
7 changed files with 55 additions and 55 deletions

View File

@@ -103,8 +103,8 @@ class Mempool {
for (const txid of transactions) {
if (!this.mempoolCache[txid]) {
const transaction = await transactionUtils.$getTransactionExtended(txid, true);
if (transaction) {
try {
const transaction = await transactionUtils.$getTransactionExtended(txid, true);
this.mempoolCache[txid] = transaction;
txCount++;
if (this.inSync) {
@@ -121,8 +121,8 @@ class Mempool {
logger.debug('Fetched transaction ' + txCount);
}
newTransactions.push(transaction);
} else {
logger.debug('Error finding transaction in mempool.');
} catch (e) {
logger.debug('Error finding transaction in mempool: ' + e.message || e);
}
}