From 2b27bff826a84ab8cb76084eb1bc7fd8029dd0ad Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Wed, 25 Dec 2024 02:35:52 +0300 Subject: [PATCH] node: init blockchain state on startup Fixes #3066 on cold starts. Signed-off-by: Pavel Karpy --- cmd/neofs-node/config.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cmd/neofs-node/config.go b/cmd/neofs-node/config.go index 0fb9430410..b097fb3bfb 100644 --- a/cmd/neofs-node/config.go +++ b/cmd/neofs-node/config.go @@ -725,6 +725,9 @@ func initBasics(c *cfg, key *keys.PrivateKey, stateStorage *state.PersistentStor lookupScriptHashesInNNS(cli, c.applicationConfiguration, &b) nState := newNetworkState() + currBlock, err := cli.BlockCount() + fatalOnErr(err) + nState.block.Store(currBlock) cnrWrap, err := cntClient.NewFromMorph(cli, b.containerSH, 0) fatalOnErr(err) @@ -738,6 +741,10 @@ func initBasics(c *cfg, key *keys.PrivateKey, stateStorage *state.PersistentStor nmWrap, err := nmClient.NewFromMorph(cli, b.netmapSH, 0) fatalOnErr(err) + eDuration, err := nmWrap.EpochDuration() + fatalOnErr(err) + nState.epochDuration.Store(eDuration) + ttl := c.applicationConfiguration.fsChain.cacheTTL if ttl == 0 { msPerBlock, err := cli.MsPerBlock()