Stubbing status, prepping txs for blockhash and addr

This commit is contained in:
tenthirtyone 2017-08-07 09:13:36 -04:00
parent 23d858f4b3
commit 3efd16c6af
4 changed files with 26 additions and 15 deletions

View File

@ -1,5 +1,5 @@
const config = {
full_node: true,
full_node: false,
logging: 'debug',
bcoin: {
network: 'main',

View File

@ -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',
},
});
});

View File

@ -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) => {

View File

@ -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}`);