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