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 = { const config = {
full_node: true, full_node: false,
logging: 'debug', logging: 'debug',
bcoin: { bcoin: {
network: 'main', network: 'main',

View File

@ -4,17 +4,17 @@ module.exports = function statusAPI(router) {
router.get('/status', (req, res) => { router.get('/status', (req, res) => {
res.json({ res.json({
info: { info: {
version: 120100, version: 0,
protocolversion: 70012, protocolversion: 0,
blocks: 479275, blocks: 0,
timeoffset: 0, timeoffset: 0,
connections: 79, connections: 0,
proxy: '', proxy: '',
difficulty: 8.60222E11, difficulty: 0,
testnet: false, testnet: false,
relayfee: 1.0E-5, relayfee: 0,
errors: "Warning: Unknown block versions being mined! It's possible unknown rules are in effect", errors: "",
network: 'livenet', network: 'main',
}, },
}); });
}); });

View File

@ -3,7 +3,7 @@ const logger = require('../logger');
const MAX_TXS = 200; const MAX_TXS = 200;
function getTransaction(params, options, cb) { function getTransactions(params, options, cb) {
const defaultOptions = { _id: 0 }; const defaultOptions = { _id: 0 };
Object.assign(defaultOptions, options); Object.assign(defaultOptions, options);
@ -18,7 +18,7 @@ function getTransaction(params, options, cb) {
module.exports = function transactionAPI(router) { module.exports = function transactionAPI(router) {
router.get('/tx/:txid', (req, res) => { router.get('/tx/:txid', (req, res) => {
getTransaction( getTransactions(
{ hash: req.params.txid }, { hash: req.params.txid },
{ }, { },
(err, tx) => { (err, tx) => {
@ -29,6 +29,7 @@ module.exports = function transactionAPI(router) {
if (tx[0]) { if (tx[0]) {
const t = tx[0]; const t = tx[0];
// Map bcoin model to insight-api
res.json({ res.json({
txid: t.hash, txid: t.hash,
version: t.version, version: t.version,
@ -67,7 +68,13 @@ module.exports = function transactionAPI(router) {
}); });
router.get('/txs', (req, res) => { router.get('/txs', (req, res) => {
getTransaction( /*
const txsBy = req.query.blocks ||
req.query.address;
*/
getTransactions(
{}, {},
{}, {},
(err, txs) => { (err, txs) => {

View File

@ -21,6 +21,10 @@ function start() {
TxParser.parse(entry, block.txs); TxParser.parse(entry, block.txs);
}); });
node.pool.on('peer', (peer) => {
//console.log(peer);
});
node.on('error', (err) => { node.on('error', (err) => {
logger.log('error', logger.log('error',
`${err}`); `${err}`);