aboutsummaryrefslogtreecommitdiffstats
path: root/ethutil/big.go
diff options
context:
space:
mode:
Diffstat (limited to 'ethutil/big.go')
-rw-r--r--ethutil/big.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/ethutil/big.go b/ethutil/big.go
index 891d476ad..1c25a4784 100644
--- a/ethutil/big.go
+++ b/ethutil/big.go
@@ -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()...)
}