[#1444] config: Fix data race on morph component init

It could be called for every shard on metabase resync concurrently and
it is possible to get state with initialized client but not initialized
contract hashes.

Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
Dmitrii Stepanov 2024-10-23 10:39:19 +03:00
parent 8b6ec57c61
commit e515dd4582
Signed by: dstepanov-yadro
GPG key ID: 237AF1A763293BC0
4 changed files with 13 additions and 11 deletions

View file

@ -13,9 +13,7 @@ import (
)
func initAccountingService(ctx context.Context, c *cfg) {
if c.cfgMorph.client == nil {
initMorphComponents(ctx, c)
}
c.initMorphComponents(ctx)
balanceMorphWrapper, err := balance.NewFromMorph(c.cfgMorph.client, c.cfgAccounting.scriptHash, 0)
fatalOnErr(err)