mempool. fix sigop counting.

This commit is contained in:
Christopher Jeffrey 2016-03-31 03:38:28 -07:00
parent a110ddab27
commit fb370eda1c
4 changed files with 7 additions and 6 deletions

View File

@ -486,7 +486,7 @@ Mempool.prototype.verify = function verify(tx, callback) {
fee = tx.getFee();
minFee = tx.getMinFee();
if (fee.cmp(minFee) < 0) {
if (self.relayPriority && fee.cmpn(0) === 0) {
if (self.relayPriority) {
free = tx.isFree(height);
if (!free) {
return callback(new VerifyError(tx,

View File

@ -896,25 +896,25 @@ Pool.prototype._handleTX = function _handleTX(tx, peer, callback) {
requested = this.fulfill(tx);
updated = this.markTX(tx, 1);
function addMempool(tx, peer, callback) {
function addMempool(tx, callback) {
if (!self.mempool)
return callback();
if (tx.ts !== 0)
return callback();
self.mempool.addTX(tx, peer, callback);
self.mempool.addTX(tx, callback);
}
this._prehandleTX(tx, peer, function(err) {
if (err)
return callback(err);
addMempool(tx, peer, function(err) {
addMempool(tx, function(err) {
if (err) {
if (err.type === 'VerifyError') {
if (err.score >= 0)
peer.sendReject(block, err.code, err.reason, err.score);
peer.sendReject(tx, err.code, err.reason, err.score);
return callback();
}
}

View File

@ -2358,7 +2358,7 @@ Script.prototype.getSigops = function getSigops(accurate) {
total++;
} else if (op === opcodes.OP_CHECKMULTISIG || op === opcodes.OP_CHECKMULTISIGVERIFY) {
if (accurate && lastOp >= opcodes.OP_1 && lastOp <= opcodes.OP_16)
total += lastOp;
total += lastOp - 0x50;
else
total += constants.script.maxPubkeysPerMultisig;
}

View File

@ -1137,6 +1137,7 @@ TX.prototype.inspect = function inspect() {
height: this.height,
value: utils.btc(this.getValue()),
fee: utils.btc(this.getFee()),
minFee: utils.btc(this.getMinFee()),
confirmations: this.getConfirmations(),
priority: this.getPriority().toString(10),
date: new Date(this.ts * 1000).toISOString(),