rpc: adjust getversion RPC response

Reference implementation includes `initialgasdistribution` as integer
value with decimals.

C# response:
```
{
    "id": 1,
    "jsonrpc": "2.0",
    "result": {
        "nonce": 1677922561,
        "protocol": {
            "addressversion": 53,
            "initialgasdistribution": 5200000000000000,
            "maxtraceableblocks": 2102400,
            "maxtransactionsperblock": 512,
            "maxvaliduntilblockincrement": 5760,
            "memorypoolmaxtransactions": 50000,
            "msperblock": 15000,
            "network": 860833102,
            "validatorscount": 7
        },
        "tcpport": 10333,
        "useragent": "/Neo:3.1.0/",
        "wsport": 10334
    }
}
```

Neo-Go response:
```
{
    "id": 1,
    "jsonrpc": "2.0",
    "result": {
        "network": 860833102,
        "nonce": 2847278838,
        "protocol": {
            "addressversion": 53,
            "initialgasdistribution": "52000000",
            "maxtraceableblocks": 2102400,
            "maxtransactionsperblock": 512,
            "maxvaliduntilblockincrement": 5760,
            "memorypoolmaxtransactions": 50000,
            "msperblock": 15000,
            "network": 860833102,
            "validatorscount": 7
        },
        "tcpport": 10333,
        "useragent": "/NEO-GO:0.98.2/"
    }
}
```
This commit is contained in:
Anna Shaleva 2022-04-14 13:51:30 +03:00
parent 6ff11baa1b
commit 1c6afe402f
2 changed files with 2 additions and 3 deletions

View file

@ -2,7 +2,6 @@ package result
import ( import (
"github.com/nspcc-dev/neo-go/pkg/config/netmode" "github.com/nspcc-dev/neo-go/pkg/config/netmode"
"github.com/nspcc-dev/neo-go/pkg/encoding/fixedn"
) )
type ( type (
@ -32,7 +31,7 @@ type (
MaxTransactionsPerBlock uint16 `json:"maxtransactionsperblock"` MaxTransactionsPerBlock uint16 `json:"maxtransactionsperblock"`
MemoryPoolMaxTransactions int `json:"memorypoolmaxtransactions"` MemoryPoolMaxTransactions int `json:"memorypoolmaxtransactions"`
ValidatorsCount byte `json:"validatorscount"` ValidatorsCount byte `json:"validatorscount"`
InitialGasDistribution fixedn.Fixed8 `json:"initialgasdistribution"` InitialGasDistribution int64 `json:"initialgasdistribution"`
// StateRootInHeader is true if state root is contained in block header. // StateRootInHeader is true if state root is contained in block header.
StateRootInHeader bool `json:"staterootinheader,omitempty"` StateRootInHeader bool `json:"staterootinheader,omitempty"`
} }

View file

@ -537,7 +537,7 @@ func (s *Server) getVersion(_ request.Params) (interface{}, *response.Error) {
MaxTransactionsPerBlock: cfg.MaxTransactionsPerBlock, MaxTransactionsPerBlock: cfg.MaxTransactionsPerBlock,
MemoryPoolMaxTransactions: cfg.MemPoolSize, MemoryPoolMaxTransactions: cfg.MemPoolSize,
ValidatorsCount: byte(cfg.GetNumOfCNs(s.chain.BlockHeight())), ValidatorsCount: byte(cfg.GetNumOfCNs(s.chain.BlockHeight())),
InitialGasDistribution: cfg.InitialGASSupply, InitialGasDistribution: int64(cfg.InitialGASSupply),
StateRootInHeader: cfg.StateRootInHeader, StateRootInHeader: cfg.StateRootInHeader,
}, },
}, nil }, nil