tx: assertions.
This commit is contained in:
parent
afb15787ad
commit
d89678eaac
@ -1508,7 +1508,7 @@ CoinSelector.prototype.fromOptions = function fromOptions(options) {
|
|||||||
|
|
||||||
if (options.subtractFee != null) {
|
if (options.subtractFee != null) {
|
||||||
if (typeof options.subtractFee === 'number') {
|
if (typeof options.subtractFee === 'number') {
|
||||||
assert(util.isNumber(options.subtractFee));
|
assert(util.isUInt32(options.subtractFee));
|
||||||
this.subtractFee = options.subtractFee;
|
this.subtractFee = options.subtractFee;
|
||||||
this.shouldSubtract = true;
|
this.shouldSubtract = true;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -2278,14 +2278,13 @@ TX.prototype.fromJSON = function fromJSON(json) {
|
|||||||
var i, input, output;
|
var i, input, output;
|
||||||
|
|
||||||
assert(json, 'TX data is required.');
|
assert(json, 'TX data is required.');
|
||||||
assert(util.isUInt32(json.version));
|
assert(util.isUInt32(json.version), 'Version must be a uint32.');
|
||||||
assert(util.isUInt8(json.flag));
|
assert(util.isUInt8(json.flag), 'Flag must be a uint8.');
|
||||||
assert(Array.isArray(json.inputs));
|
assert(Array.isArray(json.inputs), 'Inputs must be an array.');
|
||||||
assert(Array.isArray(json.outputs));
|
assert(Array.isArray(json.outputs), 'Outputs must be an array.');
|
||||||
assert(util.isUInt32(json.locktime));
|
assert(util.isUInt32(json.locktime), 'Locktime must be a uint32.');
|
||||||
|
|
||||||
this.version = json.version;
|
this.version = json.version;
|
||||||
|
|
||||||
this.flag = json.flag;
|
this.flag = json.flag;
|
||||||
|
|
||||||
for (i = 0; i < json.inputs.length; i++) {
|
for (i = 0; i < json.inputs.length; i++) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user