Merge hashrate and difficulty into one chart
This commit is contained in:
@@ -588,11 +588,18 @@ class Routes {
|
||||
|
||||
public async $getHistoricalHashrate(req: Request, res: Response) {
|
||||
try {
|
||||
const stats = await mining.$getHistoricalHashrates(req.params.interval ?? null);
|
||||
const hashrates = await mining.$getHistoricalHashrates(req.params.interval ?? null);
|
||||
const difficulty = await mining.$getHistoricalDifficulty(req.params.interval ?? null);
|
||||
const oldestIndexedBlockTimestamp = await BlocksRepository.$oldestBlockTimestamp();
|
||||
console.log(oldestIndexedBlockTimestamp);
|
||||
res.header('Pragma', 'public');
|
||||
res.header('Cache-control', 'public');
|
||||
res.setHeader('Expires', new Date(Date.now() + 1000 * 300).toUTCString());
|
||||
res.json(stats);
|
||||
res.json({
|
||||
oldestIndexedBlockTimestamp: oldestIndexedBlockTimestamp,
|
||||
hashrates: hashrates,
|
||||
difficulty: difficulty,
|
||||
});
|
||||
} catch (e) {
|
||||
res.status(500).send(e instanceof Error ? e.message : e);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user