forked from TrueCloudLab/neoneo-go
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) {
|
func (s *Server) getStorage(ps params.Params) (any, *neorpc.Error) {
|
||||||
id, rErr := s.contractIDFromParam(ps.Value(0))
|
id, rErr := s.contractIDFromParam(ps.Value(0))
|
||||||
if rErr == neorpc.ErrUnknownContract {
|
|
||||||
return nil, nil
|
|
||||||
}
|
|
||||||
if rErr != nil {
|
if rErr != nil {
|
||||||
return nil, rErr
|
return nil, rErr
|
||||||
}
|
}
|
||||||
|
@ -1736,7 +1733,7 @@ func (s *Server) getStorage(ps params.Params) (any, *neorpc.Error) {
|
||||||
|
|
||||||
item := s.chain.GetStorageItem(id, key)
|
item := s.chain.GetStorageItem(id, key)
|
||||||
if item == nil {
|
if item == nil {
|
||||||
return "", nil
|
return "", neorpc.ErrUnknownStorageItem
|
||||||
}
|
}
|
||||||
|
|
||||||
return []byte(item), nil
|
return []byte(item), nil
|
||||||
|
|
|
@ -621,12 +621,10 @@ var rpcTestCases = map[string][]rpcTestCase{
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "missing key",
|
name: "missing key",
|
||||||
params: fmt.Sprintf(`["%s", "dGU="]`, testContractHash),
|
params: fmt.Sprintf(`["%s", "dGU="]`, testContractHash),
|
||||||
result: func(e *executor) any {
|
fail: true,
|
||||||
v := ""
|
errCode: neorpc.ErrUnknownStorageItemCode,
|
||||||
return &v
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "no params",
|
name: "no params",
|
||||||
|
|
Loading…
Reference in a new issue