From 3a0be5ce282f7780f35c76d9fb8b33e2b29d7676 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Thu, 18 Jun 2020 23:09:24 +0300 Subject: [PATCH] rpc: allow to invoke `getapplicationlog` with block hash Support retrieving native contract persist results by block hash. All necessary support is already here, just add test. --- pkg/rpc/server/server_test.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/pkg/rpc/server/server_test.go b/pkg/rpc/server/server_test.go index 755ab12fa..14729e5ed 100644 --- a/pkg/rpc/server/server_test.go +++ b/pkg/rpc/server/server_test.go @@ -823,6 +823,16 @@ func testRPCProtocol(t *testing.T, doRPCCall func(string, string, *testing.T) [] }) } + t.Run("getapplicationlog for block", func(t *testing.T) { + rpc := `{"jsonrpc": "2.0", "id": 1, "method": "getapplicationlog", "params": ["%s"]}` + body := doRPCCall(fmt.Sprintf(rpc, e.chain.GetHeaderHash(1).StringLE()), httpSrv.URL, t) + data := checkErrGetResult(t, body, false) + var res result.ApplicationLog + require.NoError(t, json.Unmarshal(data, &res)) + require.Equal(t, "System", res.Trigger) + require.Equal(t, "HALT", res.VMState) + }) + t.Run("submit", func(t *testing.T) { rpc := `{"jsonrpc": "2.0", "id": 1, "method": "submitblock", "params": ["%s"]}` t.Run("invalid signature", func(t *testing.T) {