swap to BigInt
This commit is contained in:
parent
7ed0ffe4f7
commit
8caba34d89
6 changed files with 10 additions and 10 deletions
|
|
@ -5,7 +5,7 @@ class AltBlock extends Model {
|
|||
declare readonly id: number;
|
||||
declare height: number;
|
||||
declare timestamp: Date;
|
||||
declare actual_timestamp: Date;
|
||||
declare actual_timestamp: BigInt;
|
||||
declare size: BigInt;
|
||||
declare hash: string;
|
||||
declare type: number;
|
||||
|
|
@ -34,7 +34,7 @@ AltBlock.init(
|
|||
id: { type: DataTypes.INTEGER, primaryKey: true, autoIncrement: true },
|
||||
height: { type: DataTypes.INTEGER, allowNull: false },
|
||||
timestamp: { type: DataTypes.DATE, allowNull: false },
|
||||
actual_timestamp: { type: DataTypes.DATE, allowNull: true },
|
||||
actual_timestamp: { type: DataTypes.BIGINT, allowNull: true },
|
||||
size: { type: DataTypes.BIGINT, allowNull: true },
|
||||
hash: { type: DataTypes.STRING, allowNull: true },
|
||||
type: { type: DataTypes.INTEGER, allowNull: true },
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import Transaction from "./Transaction";
|
|||
class Block extends Model {
|
||||
declare readonly id: number;
|
||||
declare height: number;
|
||||
declare actual_timestamp: Date;
|
||||
declare actual_timestamp: BigInt;
|
||||
declare base_reward: string;
|
||||
declare blob: string;
|
||||
declare block_cumulative_size: string;
|
||||
|
|
@ -41,7 +41,7 @@ Block.init(
|
|||
id: { type: DataTypes.INTEGER, primaryKey: true, autoIncrement: true },
|
||||
|
||||
height: { type: DataTypes.INTEGER, allowNull: false, unique: true },
|
||||
actual_timestamp: { type: DataTypes.DATE, allowNull: true },
|
||||
actual_timestamp: { type: DataTypes.BIGINT, allowNull: true },
|
||||
base_reward: { type: DataTypes.TEXT, allowNull: true },
|
||||
blob: { type: DataTypes.STRING, allowNull: true },
|
||||
block_cumulative_size: { type: DataTypes.TEXT, allowNull: true },
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import sequelize from "../database/sequelize";
|
|||
class Chart extends Model {
|
||||
declare readonly id: number;
|
||||
declare height: number;
|
||||
declare actual_timestamp: Date;
|
||||
declare actual_timestamp: BigInt;
|
||||
declare block_cumulative_size: string;
|
||||
declare cumulative_diff_precise: string;
|
||||
declare difficulty: string;
|
||||
|
|
@ -25,7 +25,7 @@ Chart.init(
|
|||
id: { type: DataTypes.INTEGER, primaryKey: true, autoIncrement: true },
|
||||
|
||||
height: { type: DataTypes.INTEGER, allowNull: false },
|
||||
actual_timestamp: { type: DataTypes.DATE, allowNull: true },
|
||||
actual_timestamp: { type: DataTypes.BIGINT, allowNull: true },
|
||||
block_cumulative_size: { type: DataTypes.TEXT, allowNull: true },
|
||||
cumulative_diff_precise: { type: DataTypes.TEXT, allowNull: true },
|
||||
difficulty: { type: DataTypes.TEXT, allowNull: true },
|
||||
|
|
|
|||
|
|
@ -390,7 +390,7 @@ const requestsLimiter = rateLimit({
|
|||
|
||||
app.get('/api/get_chart/:chart/:offset', async (req, res) => {
|
||||
const { chart, offset } = req.params;
|
||||
const offsetDate = new Date(parseInt(offset, 10));
|
||||
const offsetDate = parseInt(offset, 10);
|
||||
|
||||
const charts = await Chart.findAll({
|
||||
attributes: ['actual_timestamp'],
|
||||
|
|
@ -1234,7 +1234,7 @@ const requestsLimiter = rateLimit({
|
|||
|
||||
chartInserts.push({
|
||||
height: bl.height,
|
||||
actual_timestamp: new Date(bl.actual_timestamp * 1000),
|
||||
actual_timestamp: bl.actual_timestamp,
|
||||
block_cumulative_size: bl.block_cumulative_size,
|
||||
cumulative_diff_precise: bl.cumulative_diff_precise,
|
||||
difficulty: bl.difficulty,
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
interface BlockInfo {
|
||||
type: "PoS" | "PoW";
|
||||
timestamp?: Date;
|
||||
actualTimestamp?: Date;
|
||||
actualTimestamp?: BigInt;
|
||||
difficulty: string;
|
||||
minerTextInfo?: string;
|
||||
cummulativeDiffAdjusted?: string;
|
||||
|
|
|
|||
|
|
@ -162,7 +162,7 @@ function Block(props: BlockProps) {
|
|||
</tr>
|
||||
<tr>
|
||||
<td>Actual Timestamp (UTC):</td>
|
||||
<td>{blockInfo?.actualTimestamp ? Utils.formatTimestampUTC(+new Date(blockInfo?.actualTimestamp)) : "-"}</td>
|
||||
<td>{blockInfo?.actualTimestamp ? Utils.formatTimestampUTC(parseInt(blockInfo?.actualTimestamp.toString(), 10)) : "-"}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Difficulty:</td>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue