diff options
author | obscuren <obscuren@obscura.com> | 2013-12-28 04:23:40 +0800 |
---|---|---|
committer | obscuren <obscuren@obscura.com> | 2013-12-28 04:23:40 +0800 |
commit | dca9ee79b3a27ba2cc5d026d445ae627a53617b0 (patch) | |
tree | f0568e37910e9e9921ab8f69a0bbf2fb1d02fbef /serialization.go | |
parent | 8301d154ae4bb6082d588bd42c6e913be63618ef (diff) | |
download | go-tangerine-dca9ee79b3a27ba2cc5d026d445ae627a53617b0.tar go-tangerine-dca9ee79b3a27ba2cc5d026d445ae627a53617b0.tar.gz go-tangerine-dca9ee79b3a27ba2cc5d026d445ae627a53617b0.tar.bz2 go-tangerine-dca9ee79b3a27ba2cc5d026d445ae627a53617b0.tar.lz go-tangerine-dca9ee79b3a27ba2cc5d026d445ae627a53617b0.tar.xz go-tangerine-dca9ee79b3a27ba2cc5d026d445ae627a53617b0.tar.zst go-tangerine-dca9ee79b3a27ba2cc5d026d445ae627a53617b0.zip |
Changed Tx serialization to return bytes instead of a string
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) } |