[#1141] morph/client: Use boolean type directly

Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
This commit is contained in:
Evgenii Stratonikov 2022-03-31 11:27:10 +03:00 committed by LeL
parent 230a5cd037
commit f65898a354
2 changed files with 4 additions and 13 deletions

View file

@ -487,15 +487,8 @@ func toStackParameter(value interface{}) (sc.Parameter, error) {
return toStackParameter(arr)
case bool:
// FIXME: #1141 there are some problems with BoolType in neo-go,
// so we use compatible type
result.Type = sc.IntegerType
if v {
result.Value = int64(1)
} else {
result.Value = int64(0)
}
result.Type = sc.BoolType
result.Value = v
default:
return result, wrapNeoFSError(fmt.Errorf("chain/client: unsupported parameter %v", value))
}

View file

@ -34,13 +34,11 @@ func TestToStackParameter(t *testing.T) {
},
{
value: false,
expType: sc.IntegerType,
expVal: int64(0),
expType: sc.BoolType,
},
{
value: true,
expType: sc.IntegerType,
expVal: int64(1),
expType: sc.BoolType,
},
}