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(); fee = tx.getFee();
minFee = tx.getMinFee(); minFee = tx.getMinFee();
if (fee.cmp(minFee) < 0) { if (fee.cmp(minFee) < 0) {
if (self.relayPriority && fee.cmpn(0) === 0) { if (self.relayPriority) {
free = tx.isFree(height); free = tx.isFree(height);
if (!free) { if (!free) {
return callback(new VerifyError(tx, return callback(new VerifyError(tx,

View File

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

View File

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

View File

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