Merge pull request #5373 from mempool/mononaut/no-405
[accelerator] remove dumb log request 405 response
This commit is contained in:
commit
5b8ec8925a
@ -465,10 +465,6 @@ class MiningRoutes {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private async $requestAcceleration(req: Request, res: Response): Promise<void> {
|
private async $requestAcceleration(req: Request, res: Response): Promise<void> {
|
||||||
if (config.MEMPOOL_SERVICES.ACCELERATIONS || config.MEMPOOL.OFFICIAL) {
|
|
||||||
res.status(405).send('not available.');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
res.setHeader('Pragma', 'no-cache');
|
res.setHeader('Pragma', 'no-cache');
|
||||||
res.setHeader('Cache-control', 'private, no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0');
|
res.setHeader('Cache-control', 'private, no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0');
|
||||||
res.setHeader('expires', -1);
|
res.setHeader('expires', -1);
|
||||||
|
@ -37,6 +37,7 @@ export interface AccelerationHistory {
|
|||||||
};
|
};
|
||||||
|
|
||||||
class AccelerationApi {
|
class AccelerationApi {
|
||||||
|
private onDemandPollingEnabled = !config.MEMPOOL_SERVICES.ACCELERATIONS;
|
||||||
private apiPath = config.MEMPOOL.OFFICIAL ? (config.MEMPOOL_SERVICES.API + '/accelerator/accelerations') : (config.EXTERNAL_DATA_SERVER.MEMPOOL_API + '/accelerations');
|
private apiPath = config.MEMPOOL.OFFICIAL ? (config.MEMPOOL_SERVICES.API + '/accelerator/accelerations') : (config.EXTERNAL_DATA_SERVER.MEMPOOL_API + '/accelerations');
|
||||||
private _accelerations: Acceleration[] | null = null;
|
private _accelerations: Acceleration[] | null = null;
|
||||||
private lastPoll = 0;
|
private lastPoll = 0;
|
||||||
@ -52,7 +53,9 @@ class AccelerationApi {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public accelerationRequested(txid: string): void {
|
public accelerationRequested(txid: string): void {
|
||||||
this.myAccelerations[txid] = { status: 'requested', added: Date.now() };
|
if (this.onDemandPollingEnabled) {
|
||||||
|
this.myAccelerations[txid] = { status: 'requested', added: Date.now() };
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public accelerationConfirmed(): void {
|
public accelerationConfirmed(): void {
|
||||||
@ -70,7 +73,7 @@ class AccelerationApi {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public async $updateAccelerations(): Promise<Acceleration[] | null> {
|
public async $updateAccelerations(): Promise<Acceleration[] | null> {
|
||||||
if (config.MEMPOOL_SERVICES.ACCELERATIONS) {
|
if (!this.onDemandPollingEnabled) {
|
||||||
const accelerations = await this.$fetchAccelerations();
|
const accelerations = await this.$fetchAccelerations();
|
||||||
if (accelerations) {
|
if (accelerations) {
|
||||||
this._accelerations = accelerations;
|
this._accelerations = accelerations;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user