Changed Tx serialization to return bytes instead of a string
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user