diff options
author | obscuren <geffobscura@gmail.com> | 2014-05-30 22:57:40 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2014-05-30 22:57:40 +0800 |
commit | b15e03acd7d6184ad920292a10d9a2bbf2b59f00 (patch) | |
tree | bc8ee730523ae58cd7e11395cc461b6ecf3e4f3d /ethutil | |
parent | e0b6a31613bc48bc5785f2bea655f832848392d8 (diff) | |
download | go-tangerine-b15e03acd7d6184ad920292a10d9a2bbf2b59f00.tar go-tangerine-b15e03acd7d6184ad920292a10d9a2bbf2b59f00.tar.gz go-tangerine-b15e03acd7d6184ad920292a10d9a2bbf2b59f00.tar.bz2 go-tangerine-b15e03acd7d6184ad920292a10d9a2bbf2b59f00.tar.lz go-tangerine-b15e03acd7d6184ad920292a10d9a2bbf2b59f00.tar.xz go-tangerine-b15e03acd7d6184ad920292a10d9a2bbf2b59f00.tar.zst go-tangerine-b15e03acd7d6184ad920292a10d9a2bbf2b59f00.zip |
Fixed issue with casting to smaller byte array
Diffstat (limited to 'ethutil')
-rw-r--r-- | ethutil/big.go | 4 |
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()...) } |