From 3efd16c6afd83b265a3d37b7c7da76867c07e760 Mon Sep 17 00:00:00 2001 From: tenthirtyone Date: Mon, 7 Aug 2017 09:13:36 -0400 Subject: [PATCH] Stubbing status, prepping txs for blockhash and addr --- config/index.js | 2 +- lib/api/status.js | 22 +++++++++++----------- lib/api/transaction.js | 13 ++++++++++--- lib/node/index.js | 4 ++++ 4 files changed, 26 insertions(+), 15 deletions(-) diff --git a/config/index.js b/config/index.js index 7830f23..cbbcfab 100644 --- a/config/index.js +++ b/config/index.js @@ -1,5 +1,5 @@ const config = { - full_node: true, + full_node: false, logging: 'debug', bcoin: { network: 'main', diff --git a/lib/api/status.js b/lib/api/status.js index a6833d5..205c940 100644 --- a/lib/api/status.js +++ b/lib/api/status.js @@ -4,17 +4,17 @@ module.exports = function statusAPI(router) { router.get('/status', (req, res) => { res.json({ info: { - version: 120100, - protocolversion: 70012, - blocks: 479275, - timeoffset: 0, - connections: 79, - proxy: '', - difficulty: 8.60222E11, - testnet: false, - relayfee: 1.0E-5, - errors: "Warning: Unknown block versions being mined! It's possible unknown rules are in effect", - network: 'livenet', + version: 0, + protocolversion: 0, + blocks: 0, + timeoffset: 0, + connections: 0, + proxy: '', + difficulty: 0, + testnet: false, + relayfee: 0, + errors: "", + network: 'main', }, }); }); diff --git a/lib/api/transaction.js b/lib/api/transaction.js index 3fd1e7d..4d0ed33 100644 --- a/lib/api/transaction.js +++ b/lib/api/transaction.js @@ -3,7 +3,7 @@ const logger = require('../logger'); const MAX_TXS = 200; -function getTransaction(params, options, cb) { +function getTransactions(params, options, cb) { const defaultOptions = { _id: 0 }; Object.assign(defaultOptions, options); @@ -18,7 +18,7 @@ function getTransaction(params, options, cb) { module.exports = function transactionAPI(router) { router.get('/tx/:txid', (req, res) => { - getTransaction( + getTransactions( { hash: req.params.txid }, { }, (err, tx) => { @@ -29,6 +29,7 @@ module.exports = function transactionAPI(router) { if (tx[0]) { const t = tx[0]; + // Map bcoin model to insight-api res.json({ txid: t.hash, version: t.version, @@ -67,7 +68,13 @@ module.exports = function transactionAPI(router) { }); router.get('/txs', (req, res) => { - getTransaction( +/* + const txsBy = req.query.blocks || + req.query.address; +*/ + + + getTransactions( {}, {}, (err, txs) => { diff --git a/lib/node/index.js b/lib/node/index.js index 9ff3472..e77de9b 100644 --- a/lib/node/index.js +++ b/lib/node/index.js @@ -21,6 +21,10 @@ function start() { TxParser.parse(entry, block.txs); }); + node.pool.on('peer', (peer) => { + //console.log(peer); + }); + node.on('error', (err) => { logger.log('error', `${err}`);