Fix bugs of common.Address.
In testnet, some of transaction has "0" as address in short.
@@ -38,7 +38,8 @@ func (a *Address) UnmarshalJSON(b []byte) error {
}
func (a *Address) SetString(s string) error {
- var isContract bool = false
+ var isContract = false
+ if len(s) >= 2 {
switch {
case s[0:2] == "cx":
isContract = true
@@ -48,6 +49,7 @@ func (a *Address) SetString(s string) error {
case s[0:2] == "0x":
s = s[2:]
}
+ }
if len(s)%2 == 1 {
s = "0" + s
}
