forked from TrueCloudLab/frostfs-node
[#396] ir: Support working with sidechain only
NeoFS contract can be deployed in sidechain instead of main chain. Add `without_mainnet` config flag that can switch IR node to work with sidechain only. By default this flag is unset. Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
ba85b9ff25
commit
53b4d6d6d0
2 changed files with 21 additions and 11 deletions
|
@ -47,6 +47,8 @@ func defaultConfiguration(cfg *viper.Viper) {
|
||||||
cfg.SetDefault("metrics.address", ":9090")
|
cfg.SetDefault("metrics.address", ":9090")
|
||||||
cfg.SetDefault("metrics.shutdown_ttl", "30s")
|
cfg.SetDefault("metrics.shutdown_ttl", "30s")
|
||||||
|
|
||||||
|
cfg.SetDefault("without_mainnet", false)
|
||||||
|
|
||||||
cfg.SetDefault("morph.endpoint.client", "")
|
cfg.SetDefault("morph.endpoint.client", "")
|
||||||
cfg.SetDefault("morph.endpoint.notification", "")
|
cfg.SetDefault("morph.endpoint.notification", "")
|
||||||
cfg.SetDefault("morph.dial_timeout", "10s")
|
cfg.SetDefault("morph.dial_timeout", "10s")
|
||||||
|
|
|
@ -238,19 +238,27 @@ func New(ctx context.Context, log *zap.Logger, cfg *viper.Viper) (*Server, error
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
mainnetChain := morphChain
|
if cfg.GetBool("without_mainnet") {
|
||||||
mainnetChain.name = mainnetPrefix
|
// This works as long as event Listener starts listening loop once,
|
||||||
|
// otherwise Server.Start will run two similar routines.
|
||||||
|
// This behavior most likely will not change.
|
||||||
|
server.mainnetListener = server.morphListener
|
||||||
|
server.mainnetClient = server.morphClient
|
||||||
|
} else {
|
||||||
|
mainnetChain := morphChain
|
||||||
|
mainnetChain.name = mainnetPrefix
|
||||||
|
|
||||||
// create mainnet listener
|
// create mainnet listener
|
||||||
server.mainnetListener, err = createListener(ctx, mainnetChain)
|
server.mainnetListener, err = createListener(ctx, mainnetChain)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// create mainnet client
|
// create mainnet client
|
||||||
server.mainnetClient, err = createClient(ctx, mainnetChain)
|
server.mainnetClient, err = createClient(ctx, mainnetChain)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
server.pubKey = crypto.MarshalPublicKey(&server.key.PublicKey)
|
server.pubKey = crypto.MarshalPublicKey(&server.key.PublicKey)
|
||||||
|
|
Loading…
Reference in a new issue