[#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) return toStackParameter(arr)
case bool: case bool:
// FIXME: #1141 there are some problems with BoolType in neo-go, result.Type = sc.BoolType
// so we use compatible type result.Value = v
result.Type = sc.IntegerType
if v {
result.Value = int64(1)
} else {
result.Value = int64(0)
}
default: default:
return result, wrapNeoFSError(fmt.Errorf("chain/client: unsupported parameter %v", value)) return result, wrapNeoFSError(fmt.Errorf("chain/client: unsupported parameter %v", value))
} }

View file

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