Fixed issue with casting to smaller byte array

pull/150/head
obscuren 10 years ago
parent e0b6a31613
commit b15e03acd7
  1. 4
      ethutil/big.go

@ -49,6 +49,10 @@ func BigD(data []byte) *big.Int {
func BigToBytes(num *big.Int, base int) []byte { func BigToBytes(num *big.Int, base int) []byte {
ret := make([]byte, base/8) ret := make([]byte, base/8)
if len(num.Bytes()) > base/8 {
return num.Bytes()
}
return append(ret[:len(ret)-len(num.Bytes())], num.Bytes()...) return append(ret[:len(ret)-len(num.Bytes())], num.Bytes()...)
} }

Loading…
Cancel
Save