mtx: add setSequence.
This commit is contained in:
parent
17487bfcf6
commit
5a41c04bfd
@ -1497,6 +1497,30 @@ MTX.prototype.setLocktime = function setLocktime(locktime) {
|
|||||||
this.locktime = locktime;
|
this.locktime = locktime;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set sequence locktime.
|
||||||
|
* @param {Number} index - Input index.
|
||||||
|
* @param {Number} locktime
|
||||||
|
* @param {Boolean?} seconds
|
||||||
|
*/
|
||||||
|
|
||||||
|
MTX.prototype.setSequence = function setSequence(index, locktime, seconds) {
|
||||||
|
var input = this.inputs[index];
|
||||||
|
|
||||||
|
assert(input, 'Input does not exist.');
|
||||||
|
|
||||||
|
this.version = 2;
|
||||||
|
|
||||||
|
if (seconds) {
|
||||||
|
locktime >>>= constants.sequence.GRANULARITY;
|
||||||
|
locktime = constants.sequence.TYPE_FLAG | locktime;
|
||||||
|
} else {
|
||||||
|
locktime = constants.sequence.MASK & locktime;
|
||||||
|
}
|
||||||
|
|
||||||
|
input.sequence = locktime;
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Mark inputs and outputs as mutable.
|
* Mark inputs and outputs as mutable.
|
||||||
* @private
|
* @private
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user