diff options
Diffstat (limited to 'serialization.go')
-rw-r--r-- | serialization.go | 8 |
1 files changed, 6 insertions, 2 deletions
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) } |