1
0
mirror of https://github.com/GOSTSec/gostexplr synced 2025-02-05 19:34:26 +00:00

Precise fields for Block selection

This commit is contained in:
xcps 2018-02-06 22:29:42 +05:00
parent 376b3ce7a2
commit a2c640b9f7
2 changed files with 3 additions and 0 deletions

View File

@ -6,6 +6,7 @@ var router = express.Router();
router.get('/', async function(req, res, next) { router.get('/', async function(req, res, next) {
const blocks = await models.Block.findAll({ const blocks = await models.Block.findAll({
attributes: ['height', 'hash'],
order: [['height', 'DESC']], order: [['height', 'DESC']],
limit: 30, limit: 30,
}); });

View File

@ -16,6 +16,7 @@ router.post('/', async function(req, res, next) {
const blockIndex = parseInt(search); const blockIndex = parseInt(search);
if (isNaN(blockIndex) === false && blockIndex.toString() === search) { if (isNaN(blockIndex) === false && blockIndex.toString() === search) {
const block = await models.Block.findOne({ const block = await models.Block.findOne({
attributes: ['hash'],
where: { where: {
height: blockIndex, height: blockIndex,
}, },
@ -51,6 +52,7 @@ router.post('/', async function(req, res, next) {
// looking for block // looking for block
const block = await models.Block.findOne({ const block = await models.Block.findOne({
attributes: ['hash'],
where: { where: {
hash: search, hash: search,
}, },