From a2c640b9f744b435035b3b87daf5f68785ca104b Mon Sep 17 00:00:00 2001 From: xcps Date: Tue, 6 Feb 2018 22:29:42 +0500 Subject: [PATCH] Precise fields for Block selection --- routes/index.js | 1 + routes/search.js | 2 ++ 2 files changed, 3 insertions(+) diff --git a/routes/index.js b/routes/index.js index fb492f3..6893d5a 100644 --- a/routes/index.js +++ b/routes/index.js @@ -6,6 +6,7 @@ var router = express.Router(); router.get('/', async function(req, res, next) { const blocks = await models.Block.findAll({ + attributes: ['height', 'hash'], order: [['height', 'DESC']], limit: 30, }); diff --git a/routes/search.js b/routes/search.js index 95a7a26..b8b396b 100644 --- a/routes/search.js +++ b/routes/search.js @@ -16,6 +16,7 @@ router.post('/', async function(req, res, next) { const blockIndex = parseInt(search); if (isNaN(blockIndex) === false && blockIndex.toString() === search) { const block = await models.Block.findOne({ + attributes: ['hash'], where: { height: blockIndex, }, @@ -51,6 +52,7 @@ router.post('/', async function(req, res, next) { // looking for block const block = await models.Block.findOne({ + attributes: ['hash'], where: { hash: search, },