diff --git a/lib/parser/transaction.js b/lib/parser/transaction.js index 5c21ffe..2850b07 100644 --- a/lib/parser/transaction.js +++ b/lib/parser/transaction.js @@ -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) => {