This commit is contained in:
obscuren 2014-07-01 23:59:37 +02:00
parent 00d3935aac
commit d7e396a98c

@ -119,7 +119,6 @@ func FormatData(data string) []byte {
d := new(big.Int) d := new(big.Int)
if data[0:1] == "\"" && data[len(data)-1:] == "\"" { if data[0:1] == "\"" && data[len(data)-1:] == "\"" {
return RightPadBytes([]byte(data), 32) return RightPadBytes([]byte(data), 32)
//d.SetBytes([]byte(data[1 : len(data)-1]))
} else if len(data) > 1 && data[:2] == "0x" { } else if len(data) > 1 && data[:2] == "0x" {
d.SetBytes(Hex2Bytes(data[2:])) d.SetBytes(Hex2Bytes(data[2:]))
} else { } else {
@ -129,7 +128,7 @@ func FormatData(data string) []byte {
return BigToBytes(d, 256) return BigToBytes(d, 256)
} }
func LeftPadBytes(slice []byte, l int) []byte { func RightPadBytes(slice []byte, l int) []byte {
if l <= len(slice) { if l <= len(slice) {
return slice return slice
} }
@ -140,7 +139,7 @@ func LeftPadBytes(slice []byte, l int) []byte {
return padded return padded
} }
func RightPadBytes(slice []byte, l int) []byte { func LeftPadBytes(slice []byte, l int) []byte {
if l <= len(slice) { if l <= len(slice) {
return slice return slice
} }