rpc: marshal GasConsumed getapplicationlog as string

Also there is no more decimal point.
This commit is contained in:
Evgenii Stratonikov 2020-06-19 11:28:31 +03:00
parent 6a2161207a
commit 3787a8895e
2 changed files with 5 additions and 3 deletions

View file

@ -113,7 +113,7 @@ var rpcClientTestCases = map[string][]rpcClientTestCase{
TxHash: txHash, TxHash: txHash,
Trigger: "Application", Trigger: "Application",
VMState: "HALT", VMState: "HALT",
GasConsumed: util.Fixed8FromInt64(1), GasConsumed: "1",
Stack: []smartcontract.Parameter{{Type: smartcontract.IntegerType, Value: int64(1)}}, Stack: []smartcontract.Parameter{{Type: smartcontract.IntegerType, Value: int64(1)}},
Events: []result.NotificationEvent{}, Events: []result.NotificationEvent{},
} }

View file

@ -1,6 +1,8 @@
package result package result
import ( import (
"strconv"
"github.com/nspcc-dev/neo-go/pkg/core/state" "github.com/nspcc-dev/neo-go/pkg/core/state"
"github.com/nspcc-dev/neo-go/pkg/smartcontract" "github.com/nspcc-dev/neo-go/pkg/smartcontract"
"github.com/nspcc-dev/neo-go/pkg/util" "github.com/nspcc-dev/neo-go/pkg/util"
@ -13,7 +15,7 @@ type ApplicationLog struct {
TxHash util.Uint256 `json:"txid"` TxHash util.Uint256 `json:"txid"`
Trigger string `json:"trigger"` Trigger string `json:"trigger"`
VMState string `json:"vmstate"` VMState string `json:"vmstate"`
GasConsumed util.Fixed8 `json:"gas_consumed"` GasConsumed string `json:"gas_consumed"`
Stack []smartcontract.Parameter `json:"stack"` Stack []smartcontract.Parameter `json:"stack"`
Events []NotificationEvent `json:"notifications"` Events []NotificationEvent `json:"notifications"`
} }
@ -46,7 +48,7 @@ func NewApplicationLog(appExecRes *state.AppExecResult) ApplicationLog {
TxHash: appExecRes.TxHash, TxHash: appExecRes.TxHash,
Trigger: appExecRes.Trigger.String(), Trigger: appExecRes.Trigger.String(),
VMState: appExecRes.VMState, VMState: appExecRes.VMState,
GasConsumed: appExecRes.GasConsumed, GasConsumed: strconv.FormatInt(int64(appExecRes.GasConsumed), 10),
Stack: appExecRes.Stack, Stack: appExecRes.Stack,
Events: events, Events: events,
} }