Code refactoring (#143)
- simplify code - prealoc slices - check errors in tests - regexp Compile replaced with MustCompile - uint* cannot be negative
This commit is contained in:
parent
9c24bf9139
commit
cdba88b9f2
12 changed files with 35 additions and 26 deletions
|
@ -60,9 +60,7 @@ func (u *Uint256) UnmarshalJSON(data []byte) (err error) {
|
|||
if err = json.Unmarshal(data, &js); err != nil {
|
||||
return err
|
||||
}
|
||||
if strings.HasPrefix(js, "0x") {
|
||||
js = js[2:]
|
||||
}
|
||||
js = strings.TrimPrefix(js, "0x")
|
||||
*u, err = Uint256DecodeString(js)
|
||||
return err
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue