Merge pull request #4108 from mempool/simon/disable-historical-testnets

Handle historical price API calls when using any testnet
This commit is contained in:
softsimon authored and GitHub committed 2023-08-09 10:51:58 +04:00
commit 8b260ce21c
3 files changed
+22 -1

No files matched your search

+4
View File
@@ -42,6 +42,10 @@ class MiningRoutes {
res.header('Pragma', 'public');
res.header('Cache-control', 'public');
res.setHeader('Expires', new Date(Date.now() + 1000 * 300).toUTCString());
if (['testnet', 'signet', 'liquidtestnet'].includes(config.MEMPOOL.NETWORK)) {
res.status(400).send('Prices are not available on testnets.');
return;
}
if (req.query.timestamp) {
res.status(200).send(await PricesRepository.$getNearestHistoricalPrice(
parseInt(<string>req.query.timestamp ?? 0, 10)