diff --git a/ethutil/bytes.go b/ethutil/bytes.go index d68a69433f49930b9302bf781c20c91b5eec026b..07584d0bfcccd3c0cd58c02de0e5afa8e140d025 100644 --- a/ethutil/bytes.go +++ b/ethutil/bytes.go @@ -149,3 +149,13 @@ func LeftPadBytes(slice []byte, l int) []byte { return padded } + +func Address(slice []byte) []byte { + if len(slice) < 20 { + slice = LeftPadBytes(slice, 20) + } else if len(slice) > 20 { + slice = slice[len(slice)-20:] + } + + return slice +}