Add separate config for mainnet, testnet and signet.

This commit is contained in:
softsimon 2022-12-01 19:48:57 +09:00
parent 75459729ad
commit 2cd98c7c04
No known key found for this signature in database
GPG Key ID: 488D7DCFB5A430D7
3 changed files with 30 additions and 9 deletions

View File

@ -17,6 +17,8 @@
"LIQUID_WEBSITE_URL": "https://liquid.network",
"BISQ_WEBSITE_URL": "https://bisq.markets",
"MINING_DASHBOARD": true,
"BLOCK_AUDIT_START_HEIGHT": 0,
"MAINNET_BLOCK_AUDIT_START_HEIGHT": 0,
"TESTNET_BLOCK_AUDIT_START_HEIGHT": 0,
"SIGNET_BLOCK_AUDIT_START_HEIGHT": 0,
"LIGHTNING": false
}

View File

@ -154,9 +154,7 @@ export class BlockComponent implements OnInit, OnDestroy {
if (history.state.data && history.state.data.block) {
this.blockHeight = history.state.data.block.height;
if (this.blockHeight < this.stateService.env.BLOCK_AUDIT_START_HEIGHT) {
this.auditDataMissing = true;
}
this.updateAuditDataMissingFromBlockHeight(this.blockHeight);
return of(history.state.data.block);
} else {
this.isLoadingBlock = true;
@ -218,9 +216,7 @@ export class BlockComponent implements OnInit, OnDestroy {
this.apiService.getBlockAudit$(block.previousblockhash);
}, 100);
}
if (block.height < this.stateService.env.BLOCK_AUDIT_START_HEIGHT) {
this.auditDataMissing = true;
}
this.updateAuditDataMissingFromBlockHeight(block.height);
this.block = block;
this.blockHeight = block.height;
this.lastBlockHeight = this.blockHeight;
@ -590,4 +586,23 @@ export class BlockComponent implements OnInit, OnDestroy {
this.hoverTx = null;
}
}
updateAuditDataMissingFromBlockHeight(blockHeight: number): void {
switch (this.stateService.network) {
case 'testnet':
if (blockHeight < this.stateService.env.TESTNET_BLOCK_AUDIT_START_HEIGHT) {
this.auditDataMissing = true;
}
break;
case 'signet':
if (blockHeight < this.stateService.env.SIGNET_BLOCK_AUDIT_START_HEIGHT) {
this.auditDataMissing = true;
}
break;
default:
if (blockHeight < this.stateService.env.MAINNET_BLOCK_AUDIT_START_HEIGHT) {
this.auditDataMissing = true;
}
}
}
}

View File

@ -39,7 +39,9 @@ export interface Env {
BISQ_WEBSITE_URL: string;
MINING_DASHBOARD: boolean;
LIGHTNING: boolean;
BLOCK_AUDIT_START_HEIGHT: number;
MAINNET_BLOCK_AUDIT_START_HEIGHT: number;
TESTNET_BLOCK_AUDIT_START_HEIGHT: number;
SIGNET_BLOCK_AUDIT_START_HEIGHT: number;
}
const defaultEnv: Env = {
@ -65,7 +67,9 @@ const defaultEnv: Env = {
'BISQ_WEBSITE_URL': 'https://bisq.markets',
'MINING_DASHBOARD': true,
'LIGHTNING': false,
'BLOCK_AUDIT_START_HEIGHT': 0,
'MAINNET_BLOCK_AUDIT_START_HEIGHT': 0,
'TESTNET_BLOCK_AUDIT_START_HEIGHT': 0,
'SIGNET_BLOCK_AUDIT_START_HEIGHT': 0,
};
@Injectable({