rpc: fix getstateheight result compatibility

C#:
   "result" : {
      "localrootindex" : 11623,
      "validatedrootindex" : 11623
   }

Go:
   "result" : {
      "blockHeight" : 11627,
      "stateHeight" : 11627
   }
This commit is contained in:
Roman Khimov 2021-07-22 19:55:41 +03:00
parent a8a6c8c13d
commit a188d20fd1
3 changed files with 6 additions and 6 deletions

View file

@ -10,8 +10,8 @@ import (
// StateHeight is a result of getstateheight RPC.
type StateHeight struct {
BlockHeight uint32 `json:"blockHeight"`
StateHeight uint32 `json:"stateHeight"`
Local uint32 `json:"localrootindex"`
Validated uint32 `json:"validatedrootindex"`
}
// ProofWithKey represens key-proof pair.

View file

@ -969,8 +969,8 @@ func (s *Server) getStateHeight(_ request.Params) (interface{}, *response.Error)
stateHeight = height - 1
}
return &result.StateHeight{
BlockHeight: height,
StateHeight: stateHeight,
Local: height,
Validated: stateHeight,
}, nil
}

View file

@ -324,8 +324,8 @@ var rpcTestCases = map[string][]rpcTestCase{
sh, ok := res.(*result.StateHeight)
require.True(t, ok)
require.Equal(t, e.chain.BlockHeight(), sh.BlockHeight)
require.Equal(t, uint32(0), sh.StateHeight)
require.Equal(t, e.chain.BlockHeight(), sh.Local)
require.Equal(t, uint32(0), sh.Validated)
},
},
},