Merge pull request #1927 from nspcc-dev/magic-network

rpc: rename magic to network in JSON
This commit is contained in:
Roman Khimov 2021-04-29 12:54:42 +03:00 committed by GitHub
commit 0c1dd9e88a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View file

@ -766,7 +766,7 @@ var rpcClientTestCases = map[string][]rpcClientTestCase{
invoke: func(c *Client) (interface{}, error) { invoke: func(c *Client) (interface{}, error) {
return c.GetVersion() return c.GetVersion()
}, },
serverResponse: `{"id":1,"jsonrpc":"2.0","result":{"magic":42,"tcpport":20332,"wsport":20342,"nonce":2153672787,"useragent":"/NEO-GO:0.73.1-pre-273-ge381358/"}}`, serverResponse: `{"id":1,"jsonrpc":"2.0","result":{"network":42,"tcpport":20332,"wsport":20342,"nonce":2153672787,"useragent":"/NEO-GO:0.73.1-pre-273-ge381358/"}}`,
result: func(c *Client) interface{} { result: func(c *Client) interface{} {
return &result.Version{ return &result.Version{
Magic: netmode.UnitTestNet, Magic: netmode.UnitTestNet,
@ -1585,7 +1585,7 @@ func wrapInitResponse(r *request.In, resp string) string {
var response string var response string
switch r.Method { switch r.Method {
case "getversion": case "getversion":
response = `{"id":1,"jsonrpc":"2.0","result":{"magic":42,"tcpport":20332,"wsport":20342,"nonce":2153672787,"useragent":"/NEO-GO:0.73.1-pre-273-ge381358/"}}` response = `{"id":1,"jsonrpc":"2.0","result":{"network":42,"tcpport":20332,"wsport":20342,"nonce":2153672787,"useragent":"/NEO-GO:0.73.1-pre-273-ge381358/"}}`
case "getcontractstate": case "getcontractstate":
p, _ := r.Params() p, _ := r.Params()
name, _ := p.ValueWithType(0, request.StringT).GetString() name, _ := p.ValueWithType(0, request.StringT).GetString()

View file

@ -6,7 +6,7 @@ type (
// Version model used for reporting server version // Version model used for reporting server version
// info. // info.
Version struct { Version struct {
Magic netmode.Magic `json:"magic"` Magic netmode.Magic `json:"network"`
TCPPort uint16 `json:"tcpport"` TCPPort uint16 `json:"tcpport"`
WSPort uint16 `json:"wsport,omitempty"` WSPort uint16 `json:"wsport,omitempty"`
Nonce uint32 `json:"nonce"` Nonce uint32 `json:"nonce"`