Merge pull request #547 from nspcc-dev/rpc-uint160
rpc: simplify uint160 handling
This commit is contained in:
commit
1217c4f62a
2 changed files with 2 additions and 7 deletions
|
@ -85,11 +85,7 @@ func (p Param) GetUint160FromHex() (util.Uint160, error) {
|
||||||
return util.Uint160{}, err
|
return util.Uint160{}, err
|
||||||
}
|
}
|
||||||
|
|
||||||
scriptHashLE, err := util.Uint160DecodeStringBE(s)
|
return util.Uint160DecodeStringLE(s)
|
||||||
if err != nil {
|
|
||||||
return util.Uint160{}, err
|
|
||||||
}
|
|
||||||
return util.Uint160DecodeBytesBE(scriptHashLE.BytesLE())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetUint160FromAddress returns Uint160 value of the parameter that was
|
// GetUint160FromAddress returns Uint160 value of the parameter that was
|
||||||
|
|
|
@ -112,8 +112,7 @@ func TestParamGetUint256(t *testing.T) {
|
||||||
|
|
||||||
func TestParamGetUint160FromHex(t *testing.T) {
|
func TestParamGetUint160FromHex(t *testing.T) {
|
||||||
in := "50befd26fdf6e4d957c11e078b24ebce6291456f"
|
in := "50befd26fdf6e4d957c11e078b24ebce6291456f"
|
||||||
u160, _ := util.Uint160DecodeStringBE(in)
|
u160, _ := util.Uint160DecodeStringLE(in)
|
||||||
u160, _ = util.Uint160DecodeBytesBE(util.ArrayReverse(u160[:]))
|
|
||||||
p := Param{stringT, in}
|
p := Param{stringT, in}
|
||||||
u, err := p.GetUint160FromHex()
|
u, err := p.GetUint160FromHex()
|
||||||
assert.Equal(t, u160, u)
|
assert.Equal(t, u160, u)
|
||||||
|
|
Loading…
Reference in a new issue