fix txJSON naming.

This commit is contained in:
tenthirtyone 2017-08-05 13:26:59 -04:00
parent a038159526
commit b74e98c381

View File

@ -9,21 +9,21 @@ function parse(entry, txs) {
txs.forEach((tx) => { txs.forEach((tx) => {
const txHash = util.revHex(tx.hash().toString('hex')); const txHash = util.revHex(tx.hash().toString('hex'));
const blockHash = util.revHex(entry.hash); const blockHash = util.revHex(entry.hash);
const json = tx.toJSON(); const txJSON = tx.totxJSON();
const t = new TxModel({ const t = new TxModel({
hash: json.hash, hash: txJSON.hash,
witnessHash: json.witnessHash, witnessHash: txJSON.witnessHash,
fee: json.fee, fee: txJSON.fee,
rate: json.rate, rate: txJSON.rate,
ps: json.ps, ps: txJSON.ps,
height: entry.height, height: entry.height,
block: entry.hash, block: entry.hash,
ts: entry.ts, ts: entry.ts,
date: json.date, date: txJSON.date,
index: json.index, index: txJSON.index,
version: json.version, version: txJSON.version,
flag: json.flag, flag: txJSON.flag,
inputs: tx.inputs.map((input) => { inputs: tx.inputs.map((input) => {
const inputJSON = input.toJSON(); const inputJSON = input.toJSON();
return new InputModel({ return new InputModel({
@ -42,7 +42,7 @@ function parse(entry, txs) {
value: outputJSON.value, value: outputJSON.value,
}); });
}), }),
lockTime: json.locktime, lockTime: txJSON.locktime,
chain: config.bcoin.network, chain: config.bcoin.network,
}); });
t.save((err) => { t.save((err) => {