[#486] morph/client: Add more global config getters

Signed-off-by: Alex Vanin <alexey@nspcc.ru>
This commit is contained in:
Alex Vanin 2021-04-21 15:25:44 +03:00 committed by Alex Vanin
parent bd65e41257
commit fd16b5701f

View file

@ -12,6 +12,8 @@ const (
epochDurationConfig = "EpochDuration" epochDurationConfig = "EpochDuration"
containerFeeConfig = "ContainerFee" containerFeeConfig = "ContainerFee"
etIterationsConfig = "EigenTrustIterations" etIterationsConfig = "EigenTrustIterations"
irCandidateFeeConfig = "InnerRingCandidateFee"
withdrawFeeConfig = "WithdrawFee"
) )
// MaxObjectSize receives max object size configuration // MaxObjectSize receives max object size configuration
@ -79,6 +81,28 @@ func (w *Wrapper) EigenTrustIterations() (uint64, error) {
return iterations, nil return iterations, nil
} }
// InnerRingCandidateFee returns global configuration value of fee payed by
// node to be in inner ring candidates list.
func (w *Wrapper) InnerRingCandidateFee() (uint64, error) {
fee, err := w.readUInt64Config(irCandidateFeeConfig)
if err != nil {
return 0, errors.Wrapf(err, "(%T) could not get inner ring candidate fee", w)
}
return fee, nil
}
// WithdrawFee returns global configuration value of fee payed by user to
// withdraw assets from NeoFS contract.
func (w *Wrapper) WithdrawFee() (uint64, error) {
fee, err := w.readUInt64Config(withdrawFeeConfig)
if err != nil {
return 0, errors.Wrapf(err, "(%T) could not get withdraw fee", w)
}
return fee, nil
}
func (w *Wrapper) readUInt64Config(key string) (uint64, error) { func (w *Wrapper) readUInt64Config(key string) (uint64, error) {
args := netmap.ConfigArgs{} args := netmap.ConfigArgs{}
args.SetKey([]byte(key)) args.SetKey([]byte(key))