mirror of
https://github.com/GOSTSec/gostexplr
synced 2025-01-30 08:24:23 +00:00
Remove confirmation for db, add confimations to transaction page
This commit is contained in:
parent
ab06b20949
commit
a186ca9ebf
@ -6,7 +6,6 @@ module.exports = (sequelize, DataTypes) => {
|
|||||||
primaryKey: true,
|
primaryKey: true,
|
||||||
},
|
},
|
||||||
hash: DataTypes.STRING(64),
|
hash: DataTypes.STRING(64),
|
||||||
confirmations: DataTypes.MEDIUMINT.UNSIGNED,
|
|
||||||
size: DataTypes.MEDIUMINT.UNSIGNED,
|
size: DataTypes.MEDIUMINT.UNSIGNED,
|
||||||
version: DataTypes.TINYINT.UNSIGNED,
|
version: DataTypes.TINYINT.UNSIGNED,
|
||||||
merkleroot: DataTypes.STRING(64),
|
merkleroot: DataTypes.STRING(64),
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
"cookie-parser": "~1.4.3",
|
"cookie-parser": "~1.4.3",
|
||||||
"debug": "~2.6.9",
|
"debug": "~2.6.9",
|
||||||
"express": "~4.15.5",
|
"express": "~4.15.5",
|
||||||
|
"forever": "^0.15.3",
|
||||||
"jade": "~1.11.0",
|
"jade": "~1.11.0",
|
||||||
"morgan": "~1.9.0",
|
"morgan": "~1.9.0",
|
||||||
"mysql": "^2.15.0",
|
"mysql": "^2.15.0",
|
||||||
|
@ -5,7 +5,7 @@ var router = express.Router();
|
|||||||
/* GET home page. */
|
/* GET home page. */
|
||||||
router.get('/:hash', async function(req, res, next) {
|
router.get('/:hash', async function(req, res, next) {
|
||||||
const hash = encodeURI(req.params.hash);
|
const hash = encodeURI(req.params.hash);
|
||||||
const block = await models.Block.findOne({
|
const blockInstance = await models.Block.findOne({
|
||||||
where: {
|
where: {
|
||||||
hash,
|
hash,
|
||||||
},
|
},
|
||||||
@ -13,7 +13,7 @@ router.get('/:hash', async function(req, res, next) {
|
|||||||
model: models.Transaction,
|
model: models.Transaction,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
if (block === null) {
|
if (blockInstance === null) {
|
||||||
res.status(404).render('404');
|
res.status(404).render('404');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -21,9 +21,11 @@ router.get('/:hash', async function(req, res, next) {
|
|||||||
attributes: [
|
attributes: [
|
||||||
[models.sequelize.fn('MAX', models.sequelize.col('height')), 'maxheight']
|
[models.sequelize.fn('MAX', models.sequelize.col('height')), 'maxheight']
|
||||||
],
|
],
|
||||||
|
raw: true,
|
||||||
});
|
});
|
||||||
block.dataValues.confirmations = lastBlock.dataValues.maxheight - block.height + 1;
|
const block = blockInstance.toJSON();
|
||||||
block.dataValues.time = block.time.toUTCString();
|
block.confirmations = lastBlock.maxheight - block.height + 1;
|
||||||
|
block.time = block.time.toUTCString();
|
||||||
res.render('block', {
|
res.render('block', {
|
||||||
block,
|
block,
|
||||||
});
|
});
|
||||||
|
@ -11,7 +11,7 @@ router.get('/:txid', async function(req, res, next) {
|
|||||||
txid,
|
txid,
|
||||||
},
|
},
|
||||||
include: [{
|
include: [{
|
||||||
attributes: ['hash', 'time'],
|
attributes: ['hash', 'time', 'height'],
|
||||||
model: models.Block,
|
model: models.Block,
|
||||||
},{
|
},{
|
||||||
model: models.Vout,
|
model: models.Vout,
|
||||||
@ -36,10 +36,18 @@ router.get('/:txid', async function(req, res, next) {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
const lastBlock = await models.Block.findOne({
|
||||||
|
attributes: [
|
||||||
|
[models.sequelize.fn('MAX', models.sequelize.col('height')), 'maxheight']
|
||||||
|
],
|
||||||
|
raw: true,
|
||||||
|
});
|
||||||
|
const confirmations = lastBlock.maxheight - transaction.Block.height + 1;
|
||||||
transaction.blockTime = transaction.Block.time.toUTCString();
|
transaction.blockTime = transaction.Block.time.toUTCString();
|
||||||
res.render('transaction', {
|
res.render('transaction', {
|
||||||
transaction,
|
transaction,
|
||||||
vouts,
|
vouts,
|
||||||
|
confirmations,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@ block content
|
|||||||
h3 Block
|
h3 Block
|
||||||
|
|
||||||
table
|
table
|
||||||
each key in Object.keys(block.dataValues)
|
each key in Object.keys(block)
|
||||||
if (key === 'nextblockhash')
|
if (key === 'nextblockhash')
|
||||||
tr
|
tr
|
||||||
td.capitalize #{key}
|
td.capitalize #{key}
|
||||||
|
@ -14,6 +14,9 @@ block content
|
|||||||
tr
|
tr
|
||||||
td Block time
|
td Block time
|
||||||
td #{transaction.blockTime}
|
td #{transaction.blockTime}
|
||||||
|
tr
|
||||||
|
td Confirmations
|
||||||
|
td #{confirmations}
|
||||||
|
|
||||||
h3 In
|
h3 In
|
||||||
if transaction.txtx.length
|
if transaction.txtx.length
|
||||||
|
Loading…
x
Reference in New Issue
Block a user