mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-12-12 11:10:35 +00:00
rpc/client: support verifyproof
RPC
This commit is contained in:
parent
654877fb1b
commit
eb37f92881
2 changed files with 25 additions and 0 deletions
|
@ -913,6 +913,20 @@ var rpcClientTestCases = map[string][]rpcClientTestCase{
|
|||
},
|
||||
},
|
||||
},
|
||||
"verifyproof": {
|
||||
{
|
||||
name: "positive",
|
||||
invoke: func(c *Client) (interface{}, error) {
|
||||
return c.VerifyProof(util.Uint256{}, new(result.ProofWithKey))
|
||||
},
|
||||
serverResponse: `{"id":1,"jsonrpc":"2.0","result":{"value":"7465737476616c7565"}}`,
|
||||
result: func(c *Client) interface{} {
|
||||
return &result.VerifyProof{
|
||||
Value: []byte("testvalue"),
|
||||
}
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
type rpcClientErrorCase struct {
|
||||
|
|
|
@ -48,3 +48,14 @@ func (c *Client) GetProof(root util.Uint256, sc util.Uint160, key []byte) (*resu
|
|||
}
|
||||
return &resp, nil
|
||||
}
|
||||
|
||||
// VerifyProof verifies keyed proof for the state with the specified root.
|
||||
func (c *Client) VerifyProof(root util.Uint256, proof *result.ProofWithKey) (*result.VerifyProof, error) {
|
||||
resp := new(result.VerifyProof)
|
||||
ps := request.NewRawParams(root, proof.String())
|
||||
err := c.performRequest("verifyproof", ps, resp)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return resp, nil
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue