1
0
mirror of https://github.com/GOSTSec/gostexplr synced 2025-01-31 17:04:24 +00:00
gostexplr/models/block.js
R4SAS 6108749fdd updates:
fixed #4,
add block processing timer,
add hashrate fetcher, add it to block table model,
updated index page output, increase output to 50 rows,
updated database block table datatypes
2019-08-24 17:35:22 +00:00

34 lines
863 B
JavaScript

'use strict';
module.exports = (sequelize, DataTypes) => {
const Block = sequelize.define('Block', {
height: {
type: DataTypes.INTEGER.UNSIGNED,
primaryKey: true,
},
hash: DataTypes.STRING(64),
size: DataTypes.MEDIUMINT.UNSIGNED,
version: DataTypes.TINYINT.UNSIGNED,
merkleroot: DataTypes.STRING(64),
time: DataTypes.DATE,
nonce: DataTypes.BIGINT.UNSIGNED,
bits: DataTypes.STRING(8),
difficulty: DataTypes.DECIMAL(16, 8).UNSIGNED,
hashrate: DataTypes.BIGINT.UNSIGNED,
previousblockhash: DataTypes.STRING(64),
nextblockhash: DataTypes.STRING(64),
}, {
timestamps: false,
indexes: [{
unique: true,
fields: ['hash', 'height']
}],
freezeTableName: true,
});
Block.associate = function(models) {
models.Block.hasMany(models.Transaction);
};
return Block;
};