From a91cf2a007966b139828f38eae9b836aab8d365f Mon Sep 17 00:00:00 2001 From: Anna Shaleva Date: Tue, 4 Oct 2022 09:02:03 +0300 Subject: [PATCH] core: set default SecondsPerBlock value on blockchain creation As mentioned in the node configuration docs. --- pkg/core/blockchain.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pkg/core/blockchain.go b/pkg/core/blockchain.go index 1c14b7851..ccdfb0524 100644 --- a/pkg/core/blockchain.go +++ b/pkg/core/blockchain.go @@ -55,6 +55,7 @@ const ( defaultMaxBlockSystemFee = 900000000000 defaultMaxTraceableBlocks = 2102400 // 1 year of 15s blocks defaultMaxTransactionsPerBlock = 512 + defaultSecondsPerBlock = 15 // HeaderVerificationGasLimit is the maximum amount of GAS for block header verification. HeaderVerificationGasLimit = 3_00000000 // 3 GAS defaultStateSyncInterval = 40000 @@ -245,6 +246,11 @@ func NewBlockchain(s storage.Store, cfg config.ProtocolConfiguration, log *zap.L log.Info("MaxTransactionsPerBlock is not set or wrong, using default value", zap.Uint16("MaxTransactionsPerBlock", cfg.MaxTransactionsPerBlock)) } + if cfg.SecondsPerBlock == 0 { + cfg.SecondsPerBlock = defaultSecondsPerBlock + log.Info("SecondsPerBlock is not set or wrong, using default value", + zap.Int("SecondsPerBlock", cfg.SecondsPerBlock)) + } if cfg.MaxValidUntilBlockIncrement == 0 { const secondsPerDay = int(24 * time.Hour / time.Second)