diff options
author | obscuren <geffobscura@gmail.com> | 2014-07-17 17:21:18 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2014-07-17 17:21:18 +0800 |
commit | ed3424ff75b396360990725afc124326dea4ab45 (patch) | |
tree | 1d1bc85f1133d5138e3c23bfdadadce54d1354ec /ethutil/bytes.go | |
parent | 14c4f06100d9f06592097c4ee588d0f83f6b17bd (diff) | |
download | dexon-ed3424ff75b396360990725afc124326dea4ab45.tar.gz dexon-ed3424ff75b396360990725afc124326dea4ab45.tar.zst dexon-ed3424ff75b396360990725afc124326dea4ab45.zip |
Trie fixes
Diffstat (limited to 'ethutil/bytes.go')
-rw-r--r-- | ethutil/bytes.go | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/ethutil/bytes.go b/ethutil/bytes.go index 07584d0bf..d16bd6780 100644 --- a/ethutil/bytes.go +++ b/ethutil/bytes.go @@ -150,12 +150,16 @@ func LeftPadBytes(slice []byte, l int) []byte { return padded } -func Address(slice []byte) []byte { +func Address(slice []byte) (addr []byte) { if len(slice) < 20 { - slice = LeftPadBytes(slice, 20) + addr = LeftPadBytes(slice, 20) } else if len(slice) > 20 { - slice = slice[len(slice)-20:] + addr = slice[len(slice)-20:] + } else { + addr = slice } - return slice + addr = CopyBytes(addr) + + return } |