Block subsidy graph back to timespan selection mode

This commit is contained in:
natsoni
2024-05-11 14:36:17 +02:00
parent 53a493c233
commit 0ef76f3e64
7 changed files with 93 additions and 236 deletions

View File

@@ -24,8 +24,6 @@ class MiningRoutes {
.get(config.MEMPOOL.API_URL_PREFIX + 'mining/difficulty-adjustments', this.$getDifficultyAdjustments)
.get(config.MEMPOOL.API_URL_PREFIX + 'mining/reward-stats/:blockCount', this.$getRewardStats)
.get(config.MEMPOOL.API_URL_PREFIX + 'mining/blocks/fees/:interval', this.$getHistoricalBlockFees)
.get(config.MEMPOOL.API_URL_PREFIX + 'mining/blocks/exact-fees/:height', this.$getHistoricalExactBlockFees)
.get(config.MEMPOOL.API_URL_PREFIX + 'mining/blocks/exact-fees', this.$getHistoricalExactBlockFees)
.get(config.MEMPOOL.API_URL_PREFIX + 'mining/blocks/rewards/:interval', this.$getHistoricalBlockRewards)
.get(config.MEMPOOL.API_URL_PREFIX + 'mining/blocks/fee-rates/:interval', this.$getHistoricalBlockFeeRates)
.get(config.MEMPOOL.API_URL_PREFIX + 'mining/blocks/sizes-weights/:interval', this.$getHistoricalBlockSizeAndWeight)
@@ -219,25 +217,6 @@ class MiningRoutes {
}
}
private async $getHistoricalExactBlockFees(req: Request, res: Response) {
try {
const heightRegex = /^(0|[1-9]\d{0,9})$/;
if (req.params.height !== undefined && !heightRegex.test(req.params.height)) {
throw new Error('Invalid height parameter');
}
const blockFees = await mining.$getHistoricalExactBlockFees(req.params.height);
const blockCount = await BlocksRepository.$blockCount(null, null);
res.header('Pragma', 'public');
res.header('Cache-control', 'public');
res.header('X-total-count', blockCount.toString());
res.setHeader('Expires', new Date(Date.now() + 1000 * 60).toUTCString());
res.json(blockFees);
} catch (e) {
res.status(500).send(e instanceof Error ? e.message : e);
}
}
private async $getHistoricalBlockRewards(req: Request, res: Response) {
try {
const blockRewards = await mining.$getHistoricalBlockRewards(req.params.interval);

View File

@@ -50,13 +50,6 @@ class Mining {
);
}
/**
* Get historical (not averaged) block total fee
*/
public async $getHistoricalExactBlockFees(height: string | null = null): Promise<any> {
return await BlocksRepository.$getHistoricalExactBlockFees(height);
}
/**
* Get historical block rewards
*/