Browse Source

Confirmations calculation

stuff
xcps 6 years ago
parent
commit
58b565f65e
  1. 2
      public/stylesheets/style.css
  2. 8
      routes/block.js

2
public/stylesheets/style.css

@ -9,7 +9,7 @@ body { @@ -9,7 +9,7 @@ body {
}
table td {
padding-right: 1em;
padding-right: .5em;
}
a {

8
routes/block.js

@ -12,11 +12,17 @@ router.get('/:hash', async function(req, res, next) { @@ -12,11 +12,17 @@ router.get('/:hash', async function(req, res, next) {
include: {
model: models.Transaction,
},
})
});
if (block === null) {
res.status(404).render('404');
return;
}
const lastBlock = await models.Block.findOne({
attributes: [
[models.sequelize.fn('MAX', models.sequelize.col('height')), 'maxheight']
],
});
block.dataValues.confirmations = lastBlock.dataValues.maxheight - block.height + 1;
block.dataValues.time = block.time.toUTCString();
res.render('block', {
block,

Loading…
Cancel
Save