diff --git a/cli/server/server_test.go b/cli/server/server_test.go index dbbfe44c9..d00959531 100644 --- a/cli/server/server_test.go +++ b/cli/server/server_test.go @@ -76,6 +76,7 @@ func TestInitBCWithMetrics(t *testing.T) { cfg, err := getConfigFromContext(ctx) require.NoError(t, err) logger, err := handleLoggingParams(ctx, cfg.ApplicationConfiguration) + require.NoError(t, err) chain, prometheus, pprof, err := initBCWithMetrics(cfg, logger) require.NoError(t, err) defer chain.Close() diff --git a/pkg/rpc/client/rpc_test.go b/pkg/rpc/client/rpc_test.go index 4d3e1b028..ec4b24356 100644 --- a/pkg/rpc/client/rpc_test.go +++ b/pkg/rpc/client/rpc_test.go @@ -1499,14 +1499,8 @@ func wrapInitResponse(r *request.In, resp string) string { case "getversion": response = `{"id":1,"jsonrpc":"2.0","result":{"magic":42,"tcpport":20332,"wsport":20342,"nonce":2153672787,"useragent":"/NEO-GO:0.73.1-pre-273-ge381358/"}}` case "getcontractstate": - p, err := r.Params() - if err != nil { - response = resp - } - name, err := p.ValueWithType(0, request.StringT).GetString() - if err != nil { - response = resp - } + p, _ := r.Params() + name, _ := p.ValueWithType(0, request.StringT).GetString() switch name { case "NeoToken": response = `{"id":1,"jsonrpc":"2.0","result":{"id":-1,"script":"DANORU9Ba2d4Cw==","manifest":{"name":"NEO","abi":{"hash":"0xde5f57d430d3dece511cf975a8d37848cb9e0525","methods":[{"name":"name","offset":0,"parameters":null,"returntype":"String"},{"name":"symbol","offset":0,"parameters":null,"returntype":"String"},{"name":"decimals","offset":0,"parameters":null,"returntype":"Integer"},{"name":"totalSupply","offset":0,"parameters":null,"returntype":"Integer"},{"name":"balanceOf","offset":0,"parameters":[{"name":"account","type":"Hash160"}],"returntype":"Integer"},{"name":"transfer","offset":0,"parameters":[{"name":"from","type":"Hash160"},{"name":"to","type":"Hash160"},{"name":"amount","type":"Integer"}],"returntype":"Boolean"},{"name":"onPersist","offset":0,"parameters":null,"returntype":"Void"},{"name":"postPersist","offset":0,"parameters":null,"returntype":"Void"},{"name":"unclaimedGas","offset":0,"parameters":[{"name":"account","type":"Hash160"},{"name":"end","type":"Integer"}],"returntype":"Integer"},{"name":"registerCandidate","offset":0,"parameters":[{"name":"pubkey","type":"PublicKey"}],"returntype":"Boolean"},{"name":"unregisterCandidate","offset":0,"parameters":[{"name":"pubkey","type":"PublicKey"}],"returntype":"Boolean"},{"name":"vote","offset":0,"parameters":[{"name":"account","type":"Hash160"},{"name":"pubkey","type":"PublicKey"}],"returntype":"Boolean"},{"name":"getCandidates","offset":0,"parameters":null,"returntype":"Array"},{"name":"getŠ”ommittee","offset":0,"parameters":null,"returntype":"Array"},{"name":"getNextBlockValidators","offset":0,"parameters":null,"returntype":"Array"},{"name":"getGasPerBlock","offset":0,"parameters":null,"returntype":"Integer"},{"name":"setGasPerBlock","offset":0,"parameters":[{"name":"gasPerBlock","type":"Integer"}],"returntype":"Boolean"}],"events":[{"name":"Transfer","parameters":null}]},"groups":[],"permissions":[{"contract":"*","methods":"*"}],"supportedstandards":["NEP-5"],"trusts":[],"safemethods":["name","symbol","decimals","totalSupply","balanceOf","unclaimedGas","getCandidates","getŠ”ommittee","getNextBlockValidators"],"extra":null},"hash":"0xde5f57d430d3dece511cf975a8d37848cb9e0525"}}` diff --git a/pkg/rpc/server/server.go b/pkg/rpc/server/server.go index 3b211f539..cf7959d72 100644 --- a/pkg/rpc/server/server.go +++ b/pkg/rpc/server/server.go @@ -878,7 +878,8 @@ func (s *Server) getStateRoot(ps request.Params) (interface{}, *response.Error) if err == nil { rt, err = s.chain.GetStateRoot(uint32(height)) } else if h, err = p.GetUint256(); err == nil { - hdr, err := s.chain.GetHeader(h) + var hdr *block.Header + hdr, err = s.chain.GetHeader(h) if err == nil { rt, err = s.chain.GetStateRoot(hdr.Index) }