Skip to content

Commit

Permalink
Precise fields for Block selection
Browse files Browse the repository at this point in the history
  • Loading branch information
xcps committed Feb 6, 2018
1 parent 376b3ce commit a2c640b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions routes/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
});
Expand Down
2 changes: 2 additions & 0 deletions routes/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
Expand Down Expand Up @@ -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,
},
Expand Down

0 comments on commit a2c640b

Please sign in to comment.