diff --git a/pkg/services/rpcsrv/server.go b/pkg/services/rpcsrv/server.go index 145b2cb6d..cfc5df532 100644 --- a/pkg/services/rpcsrv/server.go +++ b/pkg/services/rpcsrv/server.go @@ -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 diff --git a/pkg/services/rpcsrv/server_test.go b/pkg/services/rpcsrv/server_test.go index 35e58dbd9..bc098e3ca 100644 --- a/pkg/services/rpcsrv/server_test.go +++ b/pkg/services/rpcsrv/server_test.go @@ -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",