diff --git a/lib/services/bitcoind.js b/lib/services/bitcoind.js index a0298cd6..8a1e9edb 100644 --- a/lib/services/bitcoind.js +++ b/lib/services/bitcoind.js @@ -42,6 +42,7 @@ function Bitcoin(options) { // caches valid indefinitely this.transactionCache = LRU(100000); this.transactionInfoCache = LRU(100000); + this.transactionInfoCacheConfirmations = 6; this.blockCache = LRU(144); this.blockHeaderCache = LRU(288); this.zmqKnownTransactions = LRU(50); @@ -1043,7 +1044,10 @@ Bitcoin.prototype.getTransactionWithBlockInfo = function(txid, queryMempool, cal tx.__blockHash = response.result.blockhash; tx.__height = response.result.height; 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); }); }