From cbe1eeb08cde008159f7d438f440e9cdbc10768f Mon Sep 17 00:00:00 2001 From: Roman Khimov Date: Fri, 23 Jul 2021 11:46:26 +0300 Subject: [PATCH] smartcontract: add support for valueless Parameters This is fine: { "type" : "Signature" }, --- pkg/smartcontract/parameter.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pkg/smartcontract/parameter.go b/pkg/smartcontract/parameter.go index d961b191e..0702e17f8 100644 --- a/pkg/smartcontract/parameter.go +++ b/pkg/smartcontract/parameter.go @@ -109,7 +109,11 @@ func (p *Parameter) UnmarshalJSON(data []byte) (err error) { if err = json.Unmarshal(data, &r); err != nil { return } - switch p.Type = r.Type; r.Type { + p.Type = r.Type + if len(r.Value) == 0 { + return + } + switch r.Type { case BoolType: if err = json.Unmarshal(r.Value, &boolean); err != nil { return