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.shutdown_ttl", "30s")
|
||||
|
||||
cfg.SetDefault("without_mainnet", false)
|
||||
|
||||
cfg.SetDefault("morph.endpoint.client", "")
|
||||
cfg.SetDefault("morph.endpoint.notification", "")
|
||||
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
|
||||
}
|
||||
|
||||
mainnetChain := morphChain
|
||||
mainnetChain.name = mainnetPrefix
|
||||
if cfg.GetBool("without_mainnet") {
|
||||
// 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
|
||||
server.mainnetListener, err = createListener(ctx, mainnetChain)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
// create mainnet listener
|
||||
server.mainnetListener, err = createListener(ctx, mainnetChain)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// create mainnet client
|
||||
server.mainnetClient, err = createClient(ctx, mainnetChain)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
// create mainnet client
|
||||
server.mainnetClient, err = createClient(ctx, mainnetChain)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
server.pubKey = crypto.MarshalPublicKey(&server.key.PublicKey)
|
||||
|
|
Loading…
Reference in a new issue