From eb6a9fc20de67f4ba84e7c780ad4f3e6938ef31b Mon Sep 17 00:00:00 2001 From: Christopher Jeffrey Date: Tue, 22 Dec 2015 03:22:49 -0800 Subject: [PATCH] make data easier to extract from inputs and outputs. --- lib/bcoin/tx.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/lib/bcoin/tx.js b/lib/bcoin/tx.js index 7fb43297..6a15a41e 100644 --- a/lib/bcoin/tx.js +++ b/lib/bcoin/tx.js @@ -112,9 +112,15 @@ TX.prototype._input = function _input(i, index) { tx: (i.out ? i.out.tx : i.tx) || null, hash: utils.toHex(hash), index: i.out ? i.out.index : i.index, + get rhash() { + return utils.revHex(input.out.hash); + } }, script: i.script ? i.script.slice() : [], - seq: i.seq === undefined ? 0xffffffff : i.seq + seq: i.seq === undefined ? 0xffffffff : i.seq, + get data() { + return TX.getInputData(input); + } }; if (i.script && i.script._raw) @@ -433,7 +439,10 @@ TX.prototype.output = function output(options, value) { var output = { value: new bn(options.value), - script: options.script ? options.script.slice() : [] + script: options.script ? options.script.slice() : [], + get data() { + return TX.getOutputData(output); + } }; if (options.script && options.script._raw)