Browse Source

Precise fields for Block selection

stuff
xcps 7 years ago
parent
commit
a2c640b9f7
  1. 1
      routes/index.js
  2. 2
      routes/search.js

1
routes/index.js

@ -6,6 +6,7 @@ var router = express.Router(); @@ -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,
});

2
routes/search.js

@ -16,6 +16,7 @@ router.post('/', async function(req, res, next) { @@ -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) { @@ -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,
},

Loading…
Cancel
Save