top n txs setup
This commit is contained in:
parent
9b7336b066
commit
805e5ec0c3
@ -204,17 +204,15 @@ module.exports = function transactionAPI(router) {
|
||||
});
|
||||
}
|
||||
// Get last n txs
|
||||
console.log('GETTING N TXS');
|
||||
db.txs.getTopTransactions((err, txs) => {
|
||||
if (err) {
|
||||
logger.log('err',
|
||||
`/txs getTopTransactions ${err}`);
|
||||
return res.status(404).send(err);
|
||||
}
|
||||
console.log(txs.length);
|
||||
return res.json(txs);
|
||||
});
|
||||
|
||||
// return res.status(404).send({ error: 'Block hash or address expected' });
|
||||
});
|
||||
|
||||
router.get('/rawtx/:txid', (req, res) => {
|
||||
|
||||
@ -6,7 +6,7 @@ const config = require('../../config');
|
||||
// These will be replaced with more advanced mongo
|
||||
// No optimization yet.
|
||||
|
||||
const MAX_TXS = config.api.max_page_txs;
|
||||
const MAX_TXS = config.api.max_txs;
|
||||
const MAX_PAGE_TXS = config.api.max_page_txs;
|
||||
|
||||
// For Paging
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
const FullNode = require('bcoin/lib/node/fullnode');
|
||||
const logger = require('../../lib/logger');
|
||||
const BlockParser = require('../parser').Block;
|
||||
const TxParser = require('../parser').Transaction;
|
||||
const config = require('../../config');
|
||||
const socket = require('../../lib/api/socket');
|
||||
const db = require('../../lib/db');
|
||||
@ -18,6 +19,7 @@ function start() {
|
||||
|
||||
node.chain.on('connect', (entry, block) => {
|
||||
BlockParser.parse(entry, block);
|
||||
TxParser.parse(entry, block.txs);
|
||||
socket.processBlock(entry, block);
|
||||
db.blocks.bestHeight(entry.height);
|
||||
});
|
||||
|
||||
Loading…
Reference in New Issue
Block a user