forked from TrueCloudLab/frostfs-node
[#1680] morph/netmap: Support HomomorphicHashingDisabled
config
`NetworkConfiguration` represents NeoFS network configuration stored in the Sidechain. In previous implementation the configuration missed flag of disabled homomorphic hashing. Add `NetworkConfiguration.HomomorphicHashingDisabled` boolean field. Decode the field in `Client.ReadNetworkConfiguration` method. Print this value in `netmap netinfo` command of NeoFS CLI. Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
e0194dbde5
commit
d2d4191868
3 changed files with 19 additions and 0 deletions
|
@ -244,6 +244,8 @@ type NetworkConfiguration struct {
|
|||
|
||||
WithdrawalFee uint64
|
||||
|
||||
HomomorphicHashingDisabled bool
|
||||
|
||||
Raw []RawNetworkParameter
|
||||
}
|
||||
|
||||
|
@ -308,6 +310,8 @@ func (c *Client) ReadNetworkConfiguration() (NetworkConfiguration, error) {
|
|||
res.IRCandidateFee = bytesToUint64(value)
|
||||
case withdrawFeeConfig:
|
||||
res.WithdrawalFee = bytesToUint64(value)
|
||||
case homomorphicHashingDisabledKey:
|
||||
res.HomomorphicHashingDisabled = bytesToBool(value)
|
||||
}
|
||||
|
||||
return nil
|
||||
|
@ -323,6 +327,16 @@ func bytesToUint64(val []byte) uint64 {
|
|||
return bigint.FromBytes(val).Uint64()
|
||||
}
|
||||
|
||||
func bytesToBool(val []byte) bool {
|
||||
for i := range val {
|
||||
if val[i] != 0 {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
// ErrConfigNotFound is returned when the requested key was not found
|
||||
// in the network config (returned value is `Null`).
|
||||
var ErrConfigNotFound = errors.New("config value not found")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue