mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-11-26 09:42:22 +00:00
address: check for prefix when decoding
This commit is contained in:
parent
89b6cbf795
commit
c5ceb9128a
1 changed files with 5 additions and 0 deletions
|
@ -1,6 +1,8 @@
|
|||
package address
|
||||
|
||||
import (
|
||||
"errors"
|
||||
|
||||
"github.com/CityOfZion/neo-go/pkg/encoding/base58"
|
||||
"github.com/CityOfZion/neo-go/pkg/util"
|
||||
)
|
||||
|
@ -23,5 +25,8 @@ func DecodeUint160(s string) (u util.Uint160, err error) {
|
|||
if err != nil {
|
||||
return u, err
|
||||
}
|
||||
if b[0] != Prefix {
|
||||
return u, errors.New("wrong address prefix")
|
||||
}
|
||||
return util.Uint160DecodeBytesBE(b[1:21])
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue