Merge pull request #754 from nspcc-dev/bug/getapplicationlog_rpc

rpc: bug with empty stack marshalling in getapplicationlog
This commit is contained in:
Roman Khimov 2020-03-13 13:25:47 +03:00 committed by GitHub
commit ec2a7324a6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -46,12 +46,18 @@ func NewApplicationLog(appExecRes *state.AppExecResult, scriptHash util.Uint160)
triggerString := appExecRes.Trigger.String() triggerString := appExecRes.Trigger.String()
var rawStack json.RawMessage
if len(appExecRes.Stack) != 0 {
rawStack = json.RawMessage(appExecRes.Stack)
} else {
rawStack = json.RawMessage("[]")
}
executions := []Execution{{ executions := []Execution{{
Trigger: triggerString, Trigger: triggerString,
ScriptHash: scriptHash, ScriptHash: scriptHash,
VMState: appExecRes.VMState, VMState: appExecRes.VMState,
GasConsumed: appExecRes.GasConsumed, GasConsumed: appExecRes.GasConsumed,
Stack: json.RawMessage(appExecRes.Stack), Stack: rawStack,
Events: events, Events: events,
}} }}