From 31eecc5afe1492396d7dd07924da1b272abaf9b6 Mon Sep 17 00:00:00 2001 From: tenthirtyone Date: Thu, 17 Aug 2017 00:44:50 -0400 Subject: [PATCH] reduced block model and parsing. --- server/lib/parser/block.js | 37 +------------------------------------ server/models/block.js | 2 +- 2 files changed, 2 insertions(+), 37 deletions(-) diff --git a/server/lib/parser/block.js b/server/lib/parser/block.js index 7ea44aa..c8221ef 100644 --- a/server/lib/parser/block.js +++ b/server/lib/parser/block.js @@ -23,42 +23,7 @@ function parse(entry, block) { nonce: blockJSON.nonce, txs: block.txs.map((tx) => { const txJSON = tx.toJSON(); - const txRAW = tx.toRaw(); - return { - hash: txJSON.hash, - witnessHash: txJSON.witnessHash, - fee: txJSON.fee, - rate: txJSON.rate, - size: txRAW.length, - ps: txJSON.ps, - height: entry.height, - block: util.revHex(entry.hash), - ts: entry.ts, - date: txJSON.date, - index: txJSON.index, - version: txJSON.version, - flag: txJSON.flag, - inputs: tx.inputs.map((input) => { - const inputJSON = input.toJSON(); - return new InputModel({ - prevout: inputJSON.prevout, - script: inputJSON.script, - witness: inputJSON.witness, - sequence: inputJSON.sequence, - address: inputJSON.address, - }); - }), - outputs: tx.outputs.map((output) => { - const outputJSON = output.toJSON(); - return new OutputModel({ - address: outputJSON.address, - script: outputJSON.script, - value: outputJSON.value, - }); - }), - lockTime: txJSON.locktime, - chain: config.bcoin.network, - }; + return txJSON.hash; }), chainwork: entry.chainwork, reward, diff --git a/server/models/block.js b/server/models/block.js index 38ba3aa..5f5aa34 100644 --- a/server/models/block.js +++ b/server/models/block.js @@ -13,7 +13,7 @@ const BlockSchema = new Schema({ ts: { type: Number, default: 0 }, bits: { type: Number, default: 0 }, nonce: { type: Number, default: 0 }, - txs: [Transaction.schema], + txs: [{ type: String, default: '' }], chainwork: { type: Number, default: 0 }, reward: { type: Number, default: 0 }, network: { type: String, default: '' },