2020-09-08 12:01:38 +03:00
|
|
|
package neofs
|
|
|
|
|
|
|
|
import (
|
2022-01-31 14:58:55 +03:00
|
|
|
nmClient "github.com/nspcc-dev/neofs-node/pkg/morph/client/netmap"
|
2020-09-08 12:01:38 +03:00
|
|
|
neofsEvent "github.com/nspcc-dev/neofs-node/pkg/morph/event/neofs"
|
|
|
|
"go.uber.org/zap"
|
|
|
|
)
|
|
|
|
|
2022-04-21 14:28:05 +03:00
|
|
|
// Process config event by setting configuration value from the mainchain in
|
|
|
|
// the sidechain.
|
2020-09-08 12:01:38 +03:00
|
|
|
func (np *Processor) processConfig(config *neofsEvent.Config) {
|
2021-03-23 18:20:44 +03:00
|
|
|
if !np.alphabetState.IsAlphabet() {
|
|
|
|
np.log.Info("non alphabet mode, ignore config")
|
2020-09-08 12:01:38 +03:00
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2022-01-31 14:58:55 +03:00
|
|
|
prm := nmClient.SetConfigPrm{}
|
2021-11-10 14:05:51 +03:00
|
|
|
|
|
|
|
prm.SetID(config.ID())
|
|
|
|
prm.SetKey(config.Key())
|
|
|
|
prm.SetValue(config.Value())
|
|
|
|
prm.SetHash(config.TxHash())
|
|
|
|
|
|
|
|
err := np.netmapClient.SetConfig(prm)
|
2020-09-08 12:01:38 +03:00
|
|
|
if err != nil {
|
|
|
|
np.log.Error("can't relay set config event", zap.Error(err))
|
|
|
|
}
|
|
|
|
}
|