diff --git a/pkg/services/rpcsrv/client_test.go b/pkg/services/rpcsrv/client_test.go index 8f70762e3..cd4b00a88 100644 --- a/pkg/services/rpcsrv/client_test.go +++ b/pkg/services/rpcsrv/client_test.go @@ -2321,7 +2321,11 @@ func TestClient_FindStorage(t *testing.T) { // Missing item. actual, err = c.FindStorageByHash(h, []byte("unknown prefix"), nil) require.NoError(t, err) - require.Equal(t, result.FindStorage{}, actual) + require.Equal(t, result.FindStorage{ + Results: []result.KeyValue{}, + Next: 0, + Truncated: false, + }, actual) } func TestClient_FindStorageHistoric(t *testing.T) { @@ -2386,7 +2390,11 @@ func TestClient_FindStorageHistoric(t *testing.T) { require.NoError(t, err) actual, err = c.FindStorageByHashHistoric(earlyRoot.Root, h, prefix, nil) require.NoError(t, err) - require.Equal(t, result.FindStorage{}, actual) + require.Equal(t, result.FindStorage{ + Results: []result.KeyValue{}, + Next: 0, + Truncated: false, + }, actual) } func TestClient_GetStorageHistoric(t *testing.T) { diff --git a/pkg/services/rpcsrv/server.go b/pkg/services/rpcsrv/server.go index 7f6a06b3b..07861d896 100644 --- a/pkg/services/rpcsrv/server.go +++ b/pkg/services/rpcsrv/server.go @@ -1750,7 +1750,8 @@ func (s *Server) findStorageInternal(id int32, prefix []byte, start, take int, s var ( i int end = start + take - res = new(result.FindStorage) + // Result is an empty list if a contract state is not found as it is in C# implementation. + res = &result.FindStorage{Results: make([]result.KeyValue, 0)} ) seeker.SeekStorage(id, prefix, func(k, v []byte) bool { if i < start { diff --git a/pkg/services/rpcsrv/server_test.go b/pkg/services/rpcsrv/server_test.go index 513875121..573e51a8e 100644 --- a/pkg/services/rpcsrv/server_test.go +++ b/pkg/services/rpcsrv/server_test.go @@ -817,7 +817,7 @@ var rpcTestCases = map[string][]rpcTestCase{ require.True(t, ok) expected := &result.FindStorage{ - Results: nil, + Results: []result.KeyValue{}, Next: 0, Truncated: false, } @@ -956,7 +956,11 @@ var rpcTestCases = map[string][]rpcTestCase{ actual, ok := res.(*result.FindStorage) require.True(t, ok) - expected := &result.FindStorage{} + expected := &result.FindStorage{ + Results: []result.KeyValue{}, + Next: 0, + Truncated: false, + } require.Equal(t, expected, actual) }, },