strip non-essential data from redis cache txs

This commit is contained in:
Mononaut
2023-07-25 16:35:21 +09:00
parent 6ac58f2da7
commit a393f42b5e
4 changed files with 172 additions and 129 deletions

View File

@@ -149,8 +149,8 @@ class Mempool {
logger.err('failed to fetch bulk mempool transactions from esplora');
}
}
return newTransactions;
logger.info(`Done inserting loaded mempool transactions into local cache`);
return newTransactions;
}
public async $updateMemPoolInfo() {
@@ -219,7 +219,11 @@ class Mempool {
logger.info(`Missing ${transactions.length - currentMempoolSize} mempool transactions, attempting to reload in bulk from esplora`);
try {
newTransactions = await this.$reloadMempool(transactions.length);
redisCache.$addTransactions(newTransactions);
if (config.REDIS.ENABLED) {
for (const tx of newTransactions) {
await redisCache.$addTransaction(tx);
}
}
loaded = true;
} catch (e) {
logger.err('failed to load mempool in bulk from esplora, falling back to fetching individual transactions');