diff options
Diffstat (limited to 'ethutil/bytes.go')
-rw-r--r-- | ethutil/bytes.go | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/ethutil/bytes.go b/ethutil/bytes.go index d68a69433..07584d0bf 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 +} |