[#240] netmap: Support HomomorphicHashingDisabled network config

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
This commit is contained in:
Pavel Karpy 2022-06-30 18:44:40 +03:00 committed by LeL
parent df6538c68c
commit 0cd790cfe0
3 changed files with 112 additions and 1 deletions

View file

@ -212,3 +212,24 @@ func TestNetworkInfo_WithdrawalFee(t *testing.T) {
},
)
}
func TestNetworkInfo_HomomorphicHashingDisabled(t *testing.T) {
testConfigValue(t,
func(x NetworkInfo) interface{} { return x.HomomorphicHashingDisabled() },
func(info *NetworkInfo, val interface{}) {
if val.(bool) {
info.DisableHomomorphicHashing()
}
},
true, true, // it is impossible to enable hashing
"HomomorphicHashingDisabled", func(val interface{}) []byte {
data := make([]byte, 1)
if val.(bool) {
data[0] = 1
}
return data
},
)
}