Merge pull request #479 from matiu/prod2-fix-dead-cache
only cache addresses with balanceSat=0
This commit is contained in:
commit
1c1060741f
@ -98,6 +98,7 @@ Address.deleteDeadCache = function(addrStr) {
|
|||||||
|
|
||||||
|
|
||||||
Address.prototype.setCache = function() {
|
Address.prototype.setCache = function() {
|
||||||
|
|
||||||
this.cached = true;
|
this.cached = true;
|
||||||
deadCache[this.addrStr] = this;
|
deadCache[this.addrStr] = this;
|
||||||
|
|
||||||
@ -217,7 +218,7 @@ Address.prototype.update = function(next, opts) {
|
|||||||
return next();
|
return next();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (opts.includeTxInfo && this.transactions.length) {
|
if (opts.includeTxInfo && this.transactions.length && this.balanceSat == 0) {
|
||||||
return next();
|
return next();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -257,7 +258,7 @@ Address.prototype.update = function(next, opts) {
|
|||||||
confirmations: x.isConfirmedCached ? (config.safeConfirmations) : x.confirmations,
|
confirmations: x.isConfirmedCached ? (config.safeConfirmations) : x.confirmations,
|
||||||
confirmationsFromCache: !!x.isConfirmedCached,
|
confirmationsFromCache: !!x.isConfirmedCached,
|
||||||
};
|
};
|
||||||
}), 'scriptPubKey');;
|
}), 'scriptPubKey');
|
||||||
|
|
||||||
if (self.deadCacheEnable && txOut.length && !self.unspent.length) {
|
if (self.deadCacheEnable && txOut.length && !self.unspent.length) {
|
||||||
// console.log('$$$$$$$$$$$$$$$$$$$$$$$$$$$ ',self.addrStr); //TODO
|
// console.log('$$$$$$$$$$$$$$$$$$$$$$$$$$$ ',self.addrStr); //TODO
|
||||||
@ -284,7 +285,8 @@ Address.prototype.update = function(next, opts) {
|
|||||||
});
|
});
|
||||||
if (txList)
|
if (txList)
|
||||||
self.transactions = txList;
|
self.transactions = txList;
|
||||||
if (self.deadCacheEnable && self.cached) {
|
|
||||||
|
if (self.deadCacheEnable && self.cached && self.balanceSat == 0) {
|
||||||
self.setCache();
|
self.setCache();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user