aboutsummaryrefslogtreecommitdiffstats
path: root/ethutil/bytes.go
diff options
context:
space:
mode:
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
}