From dca9ee79b3a27ba2cc5d026d445ae627a53617b0 Mon Sep 17 00:00:00 2001 From: obscuren Date: Fri, 27 Dec 2013 21:23:40 +0100 Subject: Changed Tx serialization to return bytes instead of a string --- serialization.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'serialization.go') diff --git a/serialization.go b/serialization.go index 613dcdcc5..5a92a434f 100644 --- a/serialization.go +++ b/serialization.go @@ -28,6 +28,10 @@ func NumToVarInt(x int) string { func RlpEncode(object interface{}) string { if str, ok := object.(string); ok { return "\x00" + NumToVarInt(len(str)) + str + } else if num, ok := object.(uint32); ok { + return RlpEncode(Uitoa(num)) + } else if byt, ok := object.([]byte); ok { + return RlpEncode(string(byt)) } else if slice, ok := object.([]interface{}); ok { var buffer bytes.Buffer for _, val := range slice { @@ -53,7 +57,7 @@ func RlpEncode(object interface{}) string { } type RlpSerializer interface { - MarshalRls() []byte - UnmarshalRls([]byte) + MarshalRlp() []byte + UnmarshalRlp([]byte) } -- cgit v1.2.3