diff --git a/pkg/rpc/server.go b/pkg/rpc/server.go index 549fc0f2a..e9d30c8a0 100644 --- a/pkg/rpc/server.go +++ b/pkg/rpc/server.go @@ -152,7 +152,14 @@ Methods: break } - results = wrappers.NewBlock(block, s.chain) + if len(reqParams) == 2 && reqParams[1].Value == 1 { + results = wrappers.NewBlock(block, s.chain) + } else { + writer := io.NewBufBinWriter() + block.EncodeBinary(writer.BinWriter) + results = hex.EncodeToString(writer.Bytes()) + } + case "getblockcount": getblockcountCalled.Inc() results = s.chain.BlockHeight() + 1 diff --git a/pkg/rpc/server_test.go b/pkg/rpc/server_test.go index 5950d4eca..4b86ac271 100644 --- a/pkg/rpc/server_test.go +++ b/pkg/rpc/server_test.go @@ -108,7 +108,7 @@ var rpcTestCases = map[string][]rpcTestCase{ "getblock": { { name: "positive", - params: "[1]", + params: "[1, 1]", result: func(e *executor) interface{} { return &GetBlockResponse{} }, check: func(t *testing.T, e *executor, result interface{}) { res, ok := result.(*GetBlockResponse)