smartcontract: add JSON marshal/unmarshal for InteropType
We actually have to do that in order to answer getapplicationlog requests for transactions that leave some interop items on the stack. It follows the same logic our binary serializer/deserializes does leaving the type and stripping the value (whatever that is).
This commit is contained in:
parent
612500ed96
commit
03ecab5eec
2 changed files with 33 additions and 6 deletions
|
@ -85,6 +85,8 @@ func (p *Parameter) MarshalJSON() ([]byte, error) {
|
|||
case MapType:
|
||||
ppair := p.Value.([]ParameterPair)
|
||||
resultRawValue, resultErr = json.Marshal(ppair)
|
||||
case InteropInterfaceType:
|
||||
resultRawValue = []byte("null")
|
||||
default:
|
||||
resultErr = errors.Errorf("Marshaller for type %s not implemented", p.Type)
|
||||
}
|
||||
|
@ -166,6 +168,9 @@ func (p *Parameter) UnmarshalJSON(data []byte) (err error) {
|
|||
return
|
||||
}
|
||||
p.Value = h
|
||||
case InteropInterfaceType:
|
||||
// stub, ignore value, it can only be null
|
||||
p.Value = nil
|
||||
default:
|
||||
return errors.Errorf("Unmarshaller for type %s not implemented", p.Type)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue