witness json.

This commit is contained in:
Christopher Jeffrey 2016-03-06 12:43:47 -08:00
parent c2baa09b1f
commit 0104aae9c0

View File

@ -263,9 +263,7 @@ Input.prototype.toJSON = function toJSON() {
}, },
output: this.output ? this.output.toJSON() : null, output: this.output ? this.output.toJSON() : null,
script: utils.toHex(bcoin.script.encode(this.script)), script: utils.toHex(bcoin.script.encode(this.script)),
witness: this.witness.map(function(chunk) { witness: utils.toHex(bcoin.protocol.framer.witness(this.witness)),
return utils.toHex(chunk);
}),
sequence: this.sequence sequence: this.sequence
}; };
}; };
@ -278,9 +276,7 @@ Input._fromJSON = function _fromJSON(json) {
}, },
output: json.output ? bcoin.coin._fromJSON(json.output) : null, output: json.output ? bcoin.coin._fromJSON(json.output) : null,
script: bcoin.script.decode(new Buffer(json.script, 'hex')), script: bcoin.script.decode(new Buffer(json.script, 'hex')),
witness: json.witness.map(function(chunk) { witness: bcoin.protocol.parser.parseWitness(new Buffer(json.witness, 'hex')),
return new Buffer(chunk, 'hex');
}),
sequence: json.sequence sequence: json.sequence
}; };
}; };