From 4a59bdf15ab30c37d62696d325f2140d79ac7034 Mon Sep 17 00:00:00 2001 From: Daniel Liu Date: Fri, 14 Jul 2023 11:23:08 +0800 Subject: [PATCH] add function IsZero for type Address --- common/types.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/common/types.go b/common/types.go index 72234a226b..905c7d5a4e 100644 --- a/common/types.go +++ b/common/types.go @@ -193,6 +193,9 @@ func IsHexAddress(s string) bool { return len(s) == 2*AddressLength && isHex(s) } +// IsZero returns if a address is empty +func (a Address) IsZero() bool { return a == Address{} } + // Get the string representation of the underlying address func (a Address) Str() string { return string(a[:]) } func (a Address) Bytes() []byte { return a[:] }