Adding configuration for blocks and mempool blocks amount.

This commit is contained in:
softsimon
2021-07-31 17:56:10 +03:00
parent 037f472f8c
commit 1908b1a5a6
9 changed files with 23 additions and 16 deletions

View File

@@ -9,6 +9,7 @@
"NGINX_PROTOCOL": "http",
"NGINX_HOSTNAME": "127.0.0.1",
"NGINX_PORT": "80",
"MEMPOOL_BLOCKS_AMOUNT": 8,
"BLOCK_WEIGHT_UNITS": 4000000,
"BASE_MODULE": "mempool"
}

View File

@@ -183,7 +183,7 @@ export class BlockchainBlocksComponent implements OnInit, OnDestroy {
}
mountEmptyBlocks() {
const emptyBlocks = [];
for (let i = 0; i < 9; i++) {
for (let i = 0; i < this.stateService.env.KEEP_BLOCKS_AMOUNT; i++) {
emptyBlocks.push({
id: '',
height: 0,

View File

@@ -144,7 +144,7 @@ export class MempoolBlocksComponent implements OnInit, OnDestroy {
this.router.navigate([(this.network ? '/' + this.network : '') + '/mempool-block/', this.markIndex - 1]);
} else {
this.stateService.blocks$
.pipe(take(8))
.pipe(take(this.stateService.env.MEMPOOL_BLOCKS_AMOUNT))
.subscribe(([block]) => {
if (this.stateService.latestBlockHeight === block.height) {
this.router.navigate([(this.network ? '/' + this.network : '') + '/block/', block.id], { state: { data: { block } }});
@@ -275,8 +275,8 @@ export class MempoolBlocksComponent implements OnInit, OnDestroy {
mountEmptyBlocks() {
const emptyBlocks = [];
const numberOfBlocks = 8;
for (let i = 0; i <= numberOfBlocks; i++) {
const numberOfBlocks = this.stateService.env.MEMPOOL_BLOCKS_AMOUNT;
for (let i = 0; i < numberOfBlocks; i++) {
emptyBlocks.push({
blockSize: 0,
blockVSize: 0,

View File

@@ -29,6 +29,7 @@ export interface Env {
NGINX_HOSTNAME?: string;
NGINX_PORT?: string;
BLOCK_WEIGHT_UNITS: number;
MEMPOOL_BLOCKS_AMOUNT: number;
GIT_COMMIT_HASH: string;
PACKAGE_JSON_VERSION: string;
}
@@ -47,6 +48,7 @@ const defaultEnv: Env = {
'NGINX_HOSTNAME': '127.0.0.1',
'NGINX_PORT': '80',
'BLOCK_WEIGHT_UNITS': 4000000,
'MEMPOOL_BLOCKS_AMOUNT': 8,
'GIT_COMMIT_HASH': '',
'PACKAGE_JSON_VERSION': '',
};