mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-11-22 09:29:38 +00:00
rpcsrv: return error on unknown storage item from getstorage
Follow the reference implementation, the behaviour was changed in
237ef7d057
.
Signed-off-by: Tatiana Nesterenko <tatiana@nspcc.io>
This commit is contained in:
parent
d3fe92de14
commit
1e6372e6d9
2 changed files with 5 additions and 10 deletions
|
@ -1722,9 +1722,6 @@ func (s *Server) getStateRoot(ps params.Params) (any, *neorpc.Error) {
|
|||
|
||||
func (s *Server) getStorage(ps params.Params) (any, *neorpc.Error) {
|
||||
id, rErr := s.contractIDFromParam(ps.Value(0))
|
||||
if rErr == neorpc.ErrUnknownContract {
|
||||
return nil, nil
|
||||
}
|
||||
if rErr != nil {
|
||||
return nil, rErr
|
||||
}
|
||||
|
@ -1736,7 +1733,7 @@ func (s *Server) getStorage(ps params.Params) (any, *neorpc.Error) {
|
|||
|
||||
item := s.chain.GetStorageItem(id, key)
|
||||
if item == nil {
|
||||
return "", nil
|
||||
return "", neorpc.ErrUnknownStorageItem
|
||||
}
|
||||
|
||||
return []byte(item), nil
|
||||
|
|
|
@ -621,12 +621,10 @@ var rpcTestCases = map[string][]rpcTestCase{
|
|||
},
|
||||
},
|
||||
{
|
||||
name: "missing key",
|
||||
params: fmt.Sprintf(`["%s", "dGU="]`, testContractHash),
|
||||
result: func(e *executor) any {
|
||||
v := ""
|
||||
return &v
|
||||
},
|
||||
name: "missing key",
|
||||
params: fmt.Sprintf(`["%s", "dGU="]`, testContractHash),
|
||||
fail: true,
|
||||
errCode: neorpc.ErrUnknownStorageItemCode,
|
||||
},
|
||||
{
|
||||
name: "no params",
|
||||
|
|
Loading…
Reference in a new issue