Revert "rpc: marshal fees and GAS as Fixed8 decimal"

This reverts commit a79b12b4d4.
This commit is contained in:
Evgeniy Stratonikov 2021-02-09 11:16:18 +03:00
parent 71494e6ae4
commit b0fbd897ad
8 changed files with 34 additions and 51 deletions

View file

@ -6,7 +6,6 @@ import (
"github.com/nspcc-dev/neo-go/pkg/config/netmode"
"github.com/nspcc-dev/neo-go/pkg/core/transaction"
"github.com/nspcc-dev/neo-go/pkg/encoding/fixedn"
"github.com/nspcc-dev/neo-go/pkg/vm/stackitem"
)
@ -26,7 +25,7 @@ type Invoke struct {
type invokeAux struct {
State string `json:"state"`
GasConsumed fixedn.Fixed8 `json:"gasconsumed"`
GasConsumed int64 `json:"gasconsumed,string"`
Script []byte `json:"script"`
Stack json.RawMessage `json:"stack"`
FaultException string `json:"exception,omitempty"`
@ -55,7 +54,7 @@ func (r Invoke) MarshalJSON() ([]byte, error) {
}
return json.Marshal(&invokeAux{
GasConsumed: fixedn.Fixed8(r.GasConsumed),
GasConsumed: r.GasConsumed,
Script: r.Script,
State: r.State,
Stack: st,
@ -83,7 +82,7 @@ func (r *Invoke) UnmarshalJSON(data []byte) error {
r.Stack = st
}
}
r.GasConsumed = int64(aux.GasConsumed)
r.GasConsumed = aux.GasConsumed
r.Script = aux.Script
r.State = aux.State
r.FaultException = aux.FaultException

View file

@ -25,7 +25,7 @@ func TestInvoke_MarshalJSON(t *testing.T) {
require.NoError(t, err)
expected := `{
"state":"HALT",
"gasconsumed":"2.37626",
"gasconsumed":"237626000",
"script":"` + base64.StdEncoding.EncodeToString(result.Script) + `",
"stack":[
{"type":"Integer","value":"1"}