mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2025-05-04 09:02:28 +00:00
rpc: add support of getstateroot
to RPC client
This commit is contained in:
parent
4cc5957c3a
commit
83b4c6734f
3 changed files with 60 additions and 0 deletions
|
@ -471,6 +471,24 @@ func (c *Client) FindStates(stateroot util.Uint256, historicalContractHash util.
|
|||
return resp, nil
|
||||
}
|
||||
|
||||
// GetStateRootByHeight returns state root for the specified height.
|
||||
func (c *Client) GetStateRootByHeight(height uint32) (*state.MPTRoot, error) {
|
||||
return c.getStateRoot(request.NewRawParams(height))
|
||||
}
|
||||
|
||||
// GetStateRootByBlockHash returns state root for block with specified hash.
|
||||
func (c *Client) GetStateRootByBlockHash(hash util.Uint256) (*state.MPTRoot, error) {
|
||||
return c.getStateRoot(request.NewRawParams(hash))
|
||||
}
|
||||
|
||||
func (c *Client) getStateRoot(params request.RawParams) (*state.MPTRoot, error) {
|
||||
var resp = new(state.MPTRoot)
|
||||
if err := c.performRequest("getstateroot", params, resp); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
// GetStateHeight returns current validated and local node state height.
|
||||
func (c *Client) GetStateHeight() (*result.StateHeight, error) {
|
||||
var (
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue