Browse Source

Confirmations calculation

stuff
xcps 7 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 {
} }
table td { table td {
padding-right: 1em; padding-right: .5em;
} }
a { a {

8
routes/block.js

@ -12,11 +12,17 @@ router.get('/:hash', async function(req, res, next) {
include: { include: {
model: models.Transaction, model: models.Transaction,
}, },
}) });
if (block === null) { if (block === null) {
res.status(404).render('404'); res.status(404).render('404');
return; 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(); block.dataValues.time = block.time.toUTCString();
res.render('block', { res.render('block', {
block, block,

Loading…
Cancel
Save