aboutsummaryrefslogtreecommitdiffstats
path: root/ethutil/bytes.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-07-17 17:21:18 +0800
committerobscuren <geffobscura@gmail.com>2014-07-17 17:21:18 +0800
commited3424ff75b396360990725afc124326dea4ab45 (patch)
tree1d1bc85f1133d5138e3c23bfdadadce54d1354ec /ethutil/bytes.go
parent14c4f06100d9f06592097c4ee588d0f83f6b17bd (diff)
downloadgo-tangerine-ed3424ff75b396360990725afc124326dea4ab45.tar
go-tangerine-ed3424ff75b396360990725afc124326dea4ab45.tar.gz
go-tangerine-ed3424ff75b396360990725afc124326dea4ab45.tar.bz2
go-tangerine-ed3424ff75b396360990725afc124326dea4ab45.tar.lz
go-tangerine-ed3424ff75b396360990725afc124326dea4ab45.tar.xz
go-tangerine-ed3424ff75b396360990725afc124326dea4ab45.tar.zst
go-tangerine-ed3424ff75b396360990725afc124326dea4ab45.zip
Trie fixes
Diffstat (limited to 'ethutil/bytes.go')
-rw-r--r--ethutil/bytes.go12
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
}