remove Block from status
This commit is contained in:
parent
9045eacccd
commit
90adbf3ece
@ -1,28 +1,7 @@
|
|||||||
const Block = require('../../models/block.js');
|
|
||||||
const pkg = require('../../package.json');
|
const pkg = require('../../package.json');
|
||||||
|
|
||||||
const logger = require('../logger');
|
const logger = require('../logger');
|
||||||
|
|
||||||
const MAX_BLOCKS = 200;
|
|
||||||
|
|
||||||
// Not dry, in multiple APIs. Refactor to db api
|
|
||||||
function getBlock(params, options, limit, cb) {
|
|
||||||
const defaultOptions = { _id: 0 };
|
|
||||||
|
|
||||||
if (!Number.isInteger(limit)) {
|
|
||||||
limit = MAX_BLOCKS;
|
|
||||||
}
|
|
||||||
|
|
||||||
Object.assign(defaultOptions, options);
|
|
||||||
|
|
||||||
Block.find(
|
|
||||||
params,
|
|
||||||
defaultOptions,
|
|
||||||
cb)
|
|
||||||
.sort({ height: -1 })
|
|
||||||
.limit(limit);
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = function statusAPI(router) {
|
module.exports = function statusAPI(router) {
|
||||||
router.get('/status', (req, res) => {
|
router.get('/status', (req, res) => {
|
||||||
res.json({
|
res.json({
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user