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
|
package address
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"errors"
|
||||||
|
|
||||||
"github.com/CityOfZion/neo-go/pkg/encoding/base58"
|
"github.com/CityOfZion/neo-go/pkg/encoding/base58"
|
||||||
"github.com/CityOfZion/neo-go/pkg/util"
|
"github.com/CityOfZion/neo-go/pkg/util"
|
||||||
)
|
)
|
||||||
|
@ -23,5 +25,8 @@ func DecodeUint160(s string) (u util.Uint160, err error) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return u, err
|
return u, err
|
||||||
}
|
}
|
||||||
|
if b[0] != Prefix {
|
||||||
|
return u, errors.New("wrong address prefix")
|
||||||
|
}
|
||||||
return util.Uint160DecodeBytesBE(b[1:21])
|
return util.Uint160DecodeBytesBE(b[1:21])
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue