more mempool work.

This commit is contained in:
Christopher Jeffrey 2016-05-12 03:05:34 -07:00
parent f4f4658390
commit 9a42f86c2e
No known key found for this signature in database
GPG Key ID: 8962AB9DE6666BBD

View File

@ -629,15 +629,8 @@ Mempool.prototype.addTX = function addTX(tx, callback, force) {
if (err) if (err)
return callback(err); return callback(err);
if (!tx.hasCoins()) { if (!tx.hasCoins())
if (self.getSize() > self.maxSize) {
return callback(new VerifyError(tx,
'insufficientfee',
'mempool full',
0));
}
return self.storeOrphan(tx, callback); return self.storeOrphan(tx, callback);
}
self.verify(tx, function(err) { self.verify(tx, function(err) {
if (err) if (err)
@ -774,7 +767,7 @@ Mempool.prototype.removeUnchecked = function removeUnchecked(tx, limit, callback
Mempool.prototype.getMinRate = function getMinRate() { Mempool.prototype.getMinRate = function getMinRate() {
var now, halflife, exp; var now, halflife, exp;
if (!this.blockSinceBump || this.minFeeRate == 0) if (!this.blockSinceBump || this.minFeeRate === 0)
return this.minFeeRate; return this.minFeeRate;
now = utils.now(); now = utils.now();
@ -1663,7 +1656,7 @@ MempoolTX.fromRaw = function fromRaw(data, saveCoins) {
MempoolTX.prototype.getPriority = function getPriority(height) { MempoolTX.prototype.getPriority = function getPriority(height) {
var heightDelta = Math.max(0, height - this.height); var heightDelta = Math.max(0, height - this.height);
var modSize = this.tx.getModifiedSize(); var modSize = this.tx.getModifiedSize(this.size);
var deltaPriority = new bn(heightDelta).mul(this.chainValue).divn(modSize); var deltaPriority = new bn(heightDelta).mul(this.chainValue).divn(modSize);
var result = this.priority.add(deltaPriority); var result = this.priority.add(deltaPriority);
if (result.cmpn(0) < 0) if (result.cmpn(0) < 0)