bitcoind: only cache transaction with height if confirmations >= 6
This commit is contained in:
parent
18310268a5
commit
7c6e5cf7b1
@ -42,6 +42,7 @@ function Bitcoin(options) {
|
|||||||
// caches valid indefinitely
|
// caches valid indefinitely
|
||||||
this.transactionCache = LRU(100000);
|
this.transactionCache = LRU(100000);
|
||||||
this.transactionInfoCache = LRU(100000);
|
this.transactionInfoCache = LRU(100000);
|
||||||
|
this.transactionInfoCacheConfirmations = 6;
|
||||||
this.blockCache = LRU(144);
|
this.blockCache = LRU(144);
|
||||||
this.blockHeaderCache = LRU(288);
|
this.blockHeaderCache = LRU(288);
|
||||||
this.zmqKnownTransactions = LRU(50);
|
this.zmqKnownTransactions = LRU(50);
|
||||||
@ -1043,7 +1044,10 @@ Bitcoin.prototype.getTransactionWithBlockInfo = function(txid, queryMempool, cal
|
|||||||
tx.__blockHash = response.result.blockhash;
|
tx.__blockHash = response.result.blockhash;
|
||||||
tx.__height = response.result.height;
|
tx.__height = response.result.height;
|
||||||
tx.__timestamp = response.result.time;
|
tx.__timestamp = response.result.time;
|
||||||
self.transactionInfoCache.set(txid, tx);
|
var confirmations = self._getConfirmationsDetail(tx);
|
||||||
|
if (confirmations >= self.transactionInfoCacheConfirmations) {
|
||||||
|
self.transactionInfoCache.set(txid, tx);
|
||||||
|
}
|
||||||
callback(null, tx);
|
callback(null, tx);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user