mempool: do not accept replace by fee.
This commit is contained in:
parent
da6a575469
commit
acaf0600e7
@ -644,6 +644,12 @@ Mempool.prototype._addTX = co(function* _addTX(tx) {
|
||||
ret.reason,
|
||||
ret.score);
|
||||
}
|
||||
if (tx.isRBF()) {
|
||||
throw new VerifyError(tx,
|
||||
'nonstandard',
|
||||
'replace-by-fee',
|
||||
0);
|
||||
}
|
||||
}
|
||||
|
||||
result = yield this.chain.checkFinal(this.chain.tip, tx, lockFlags);
|
||||
|
||||
@ -221,6 +221,15 @@ Input.prototype.isFinal = function isFinal() {
|
||||
return this.sequence === 0xffffffff;
|
||||
};
|
||||
|
||||
/**
|
||||
* Test to see if nSequence is less than 0xfffffffe.
|
||||
* @returns {Boolean}
|
||||
*/
|
||||
|
||||
Input.prototype.isRBF = function isRBF() {
|
||||
return this.sequence < 0xfffffffe;
|
||||
};
|
||||
|
||||
/**
|
||||
* Test to see if outpoint is null.
|
||||
* @returns {Boolean}
|
||||
|
||||
@ -782,6 +782,31 @@ TX.prototype.isCoinbase = function isCoinbase() {
|
||||
return this.inputs.length === 1 && this.inputs[0].prevout.isNull();
|
||||
};
|
||||
|
||||
/**
|
||||
* Test whether the transaction is a replacement.
|
||||
* @returns {Boolean}
|
||||
*/
|
||||
|
||||
TX.prototype.isRBF = function isRBF() {
|
||||
var i, input;
|
||||
|
||||
for (i = 0; i < this.inputs.length; i++) {
|
||||
input = this.inputs[i];
|
||||
|
||||
if (!input.isRBF())
|
||||
continue;
|
||||
|
||||
if (this.version === 2) {
|
||||
if (!(input.sequence & constants.sequence.DISABLE_FLAG))
|
||||
continue;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
/**
|
||||
* Calculate the fee for the transaction.
|
||||
* @returns {Amount} fee (zero if not all coins are available).
|
||||
|
||||
Loading…
Reference in New Issue
Block a user