Skip to content

Commit

Permalink
Fixed issue with casting to smaller byte array
Browse files Browse the repository at this point in the history
  • Loading branch information
obscuren committed May 30, 2014
1 parent e0b6a31 commit b15e03a
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions ethutil/big.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ func BigD(data []byte) *big.Int {
func BigToBytes(num *big.Int, base int) []byte {
ret := make([]byte, base/8)

if len(num.Bytes()) > base/8 {
return num.Bytes()
}

return append(ret[:len(ret)-len(num.Bytes())], num.Bytes()...)
}

Expand Down

0 comments on commit b15e03a

Please sign in to comment.