From afa7d9ec801d348b92139d012da95f978174e86f Mon Sep 17 00:00:00 2001 From: David Cumps Date: Wed, 5 Jan 2022 05:53:51 +0100 Subject: [PATCH] Add `blocksPerMessage` as configuration option. (#747) * fix: sync only 2 blocks per time * chore: lint * chore: lint, remove space --- ironfish/src/fileStores/config.ts | 6 ++++++ ironfish/src/node.ts | 1 + 2 files changed, 7 insertions(+) diff --git a/ironfish/src/fileStores/config.ts b/ironfish/src/fileStores/config.ts index 9389ce510b..daf11e8fa0 100644 --- a/ironfish/src/fileStores/config.ts +++ b/ironfish/src/fileStores/config.ts @@ -110,6 +110,11 @@ export type ConfigOptions = { * mempool. */ defaultTransactionExpirationSequenceDelta: number + + /** + * The default number of blocks to request per message when syncing. + */ + blocksPerMessage: number } export const ConfigOptionsSchema: yup.ObjectSchema> = yup @@ -172,6 +177,7 @@ export class Config extends KeyStore { telemetryApi: DEFAULT_TELEMETRY_API, accountName: DEFAULT_WALLET_NAME, generateNewIdentity: false, + blocksPerMessage: 20, } } } diff --git a/ironfish/src/node.ts b/ironfish/src/node.ts index 01b12a3de2..9dfbccf8c7 100644 --- a/ironfish/src/node.ts +++ b/ironfish/src/node.ts @@ -112,6 +112,7 @@ export class IronfishNode { logger: logger, peerNetwork: this.peerNetwork, strategy: this.strategy, + blocksPerMessage: config.get('blocksPerMessage'), }) this.config.onConfigChange.on((key, value) => this.onConfigChange(key, value))