From 2ef4b05f8eb5437c6be67794f057ac2ee6465705 Mon Sep 17 00:00:00 2001
From: Benjamin Bollen <ben@monax.io>
Date: Mon, 27 Feb 2017 18:44:19 +0100
Subject: [PATCH] rpc/v0: update TestCallTxJsonFormatCodec to use
 codec.DecodeBytesPtr

rpc/v0: gofmt and small comment
---
 rpc/v0/codec.go                  | 9 +++++----
 rpc/v0/json_service_data_test.go | 2 +-
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/rpc/v0/codec.go b/rpc/v0/codec.go
index 87eb73b3..344c1c98 100644
--- a/rpc/v0/codec.go
+++ b/rpc/v0/codec.go
@@ -45,6 +45,8 @@ func (this *TCodec) EncodeBytes(v interface{}) ([]byte, error) {
 	return wire.JSONBytes(v), nil
 }
 
+// TODO: [ben] implement EncodeBytesPtr ?
+
 // Decode from an io.Reader.
 func (this *TCodec) Decode(v interface{}, r io.Reader) error {
 	bts, errR := ioutil.ReadAll(r)
@@ -65,8 +67,7 @@ func (this *TCodec) DecodeBytes(v interface{}, bts []byte) error {
 
 // Decode from a byte array pointer.
 func (this *TCodec) DecodeBytesPtr(v interface{}, bts []byte) error {
-       var err error
-       wire.ReadJSONPtr(v, bts, &err)
-       return err
+	var err error
+	wire.ReadJSONPtr(v, bts, &err)
+	return err
 }
-
diff --git a/rpc/v0/json_service_data_test.go b/rpc/v0/json_service_data_test.go
index e37f6733..96be0413 100644
--- a/rpc/v0/json_service_data_test.go
+++ b/rpc/v0/json_service_data_test.go
@@ -64,7 +64,7 @@ func TestCallTxJsonFormatCodec(t *testing.T) {
 	request := &rpc.RPCRequest{}
 	assert.NoError(t, json.Unmarshal(testBroadcastCallTxJsonRequest, request),
 		"Provided JSON test data does not unmarshal to rpc.RPCRequest object.")
-	assert.NoError(t, codec.DecodeBytes(param, request.Params),
+	assert.NoError(t, codec.DecodeBytesPtr(param, request.Params),
 		"RPC codec failed to decode params as transaction type.")
 	_, ok := (*param).(*txs.CallTx)
 	assert.True(t, ok, "Type byte 0x02 should unmarshal into CallTx.")
-- 
GitLab