Merge pull request #4849 from mempool/mononaut/backend-backend-info

Add backend mode to backend-info
This commit is contained in:
softsimon 2024-04-01 15:27:38 +09:00 committed by GitHub
commit 4a3aceadbf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 4 deletions

View File

@ -9,8 +9,8 @@ class BackendInfo {
constructor() { constructor() {
// This file is created by ./fetch-version.ts during building // This file is created by ./fetch-version.ts during building
const versionFile = path.join(__dirname, 'version.json') const versionFile = path.join(__dirname, 'version.json');
var versionInfo; let versionInfo;
if (fs.existsSync(versionFile)) { if (fs.existsSync(versionFile)) {
versionInfo = JSON.parse(fs.readFileSync(versionFile).toString()); versionInfo = JSON.parse(fs.readFileSync(versionFile).toString());
} else { } else {
@ -24,7 +24,8 @@ class BackendInfo {
hostname: os.hostname(), hostname: os.hostname(),
version: versionInfo.version, version: versionInfo.version,
gitCommit: versionInfo.gitCommit, gitCommit: versionInfo.gitCommit,
lightning: config.LIGHTNING.ENABLED lightning: config.LIGHTNING.ENABLED,
backend: config.MEMPOOL.BACKEND,
}; };
} }
@ -32,7 +33,7 @@ class BackendInfo {
return this.backendInfo; return this.backendInfo;
} }
public getShortCommitHash() { public getShortCommitHash(): string {
return this.backendInfo.gitCommit.slice(0, 7); return this.backendInfo.gitCommit.slice(0, 7);
} }
} }

View File

@ -455,6 +455,7 @@ export interface IBackendInfo {
gitCommit: string; gitCommit: string;
version: string; version: string;
lightning: boolean; lightning: boolean;
backend: 'esplora' | 'electrum' | 'none';
} }
export interface IDifficultyAdjustment { export interface IDifficultyAdjustment {