This commit is contained in:
Christopher Jeffrey 2016-03-26 05:11:37 -07:00
parent 5912d65fa8
commit 430e917b79

View File

@ -296,6 +296,11 @@ Mempool.prototype.addTX = function addTX(tx, peer, callback, force) {
callback = utils.wrap(callback, unlock);
callback = utils.asyncify(callback);
if (!this.chain.segwitActive) {
if (tx.hasWitness())
return callback(new VerifyError('nonstandard', 'no-witness-yet', 0));
}
if (!this.checkTX(tx, peer))
return callback(new VerifyError('invalid', 'CheckTransaction failed', -1));
@ -421,9 +426,6 @@ Mempool.prototype.verify = function verify(tx, callback) {
if (this.chain.segwitActive) {
flags |= constants.flags.VERIFY_WITNESS;
mandatory |= constants.flags.VERIFY_WITNESS;
} else {
if (tx.hasWitness())
return callback(new VerifyError('nonstandard', 'no-witness-yet', 0));
}
if (this.requireStandard && !tx.isStandardInputs(flags)) {
@ -516,7 +518,7 @@ Mempool.prototype.verify = function verify(tx, callback) {
0));
}
this.freeCount += tx.getVirtualSize();
this.freeCount += tx.getSize();
}
if (this.rejectInsaneFees && fee.cmp(minFee.muln(10000)) > 0)
@ -543,16 +545,16 @@ Mempool.prototype.verify = function verify(tx, callback) {
if (err)
return callback(err);
if (!result) {
if (result) {
return callback(new VerifyError(
'nonstandard',
'mandatory-script-verify-flag',
'non-mandatory-script-verify-flag',
0));
}
return callback(new VerifyError(
'nonstandard',
'non-mandatory-script-verify-flag',
'mandatory-script-verify-flag',
0));
});
}