Always fetch at least the coinbase transaction of blocks, and throw error if failed.
This commit is contained in:
parent
cca95bbd66
commit
c9e175a0cc
@ -70,13 +70,16 @@ class Blocks {
|
|||||||
if (mempool[txIds[i]]) {
|
if (mempool[txIds[i]]) {
|
||||||
transactions.push(mempool[txIds[i]]);
|
transactions.push(mempool[txIds[i]]);
|
||||||
transactionsFound++;
|
transactionsFound++;
|
||||||
} else if (config.MEMPOOL.BACKEND === 'esplora' || memPool.isInSync()) {
|
} else if (config.MEMPOOL.BACKEND === 'esplora' || memPool.isInSync() || i === 0) {
|
||||||
logger.debug(`Fetching block tx ${i} of ${txIds.length}`);
|
logger.debug(`Fetching block tx ${i} of ${txIds.length}`);
|
||||||
try {
|
try {
|
||||||
const tx = await transactionUtils.$getTransactionExtended(txIds[i]);
|
const tx = await transactionUtils.$getTransactionExtended(txIds[i]);
|
||||||
transactions.push(tx);
|
transactions.push(tx);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
logger.debug('Error fetching block tx: ' + e.message || e);
|
logger.debug('Error fetching block tx: ' + e.message || e);
|
||||||
|
if (i === 0) {
|
||||||
|
throw new Error('Failed to fetch Coinbase transaction: ' + txIds[i]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user