Merge pull request #3119 from mempool/nymkappa/bugfix/historical-price-bitcoin-only

Only query historical price if we're running mempool BASE_MODULE
This commit is contained in:
wiz 2023-02-24 17:10:22 +09:00 committed by GitHub
commit 7d3c7c3f45
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,6 +1,7 @@
import { Injectable } from '@angular/core';
import { map, Observable, of, share, shareReplay, tap } from 'rxjs';
import { ApiService } from './api.service';
import { StateService } from './state.service';
// nodejs backend interfaces
export interface ApiPrice {
@ -52,7 +53,8 @@ export class PriceService {
};
constructor(
private apiService: ApiService
private apiService: ApiService,
private stateService: StateService
) {
}
@ -68,6 +70,10 @@ export class PriceService {
}
getBlockPrice$(blockTimestamp: number, singlePrice = false): Observable<Price | undefined> {
if (this.stateService.env.BASE_MODULE !== 'mempool') {
return of(undefined);
}
const now = new Date().getTime() / 1000;
/**