[#302] user: Make ScriptHash
return no error
Signed-off-by: Ekaterina Lebedeva <ekaterina.lebedeva@yadro.com>
This commit is contained in:
parent
9d7f7bd04f
commit
761d087b93
2 changed files with 4 additions and 4 deletions
|
@ -73,8 +73,9 @@ func (x *ID) SetScriptHash(scriptHash util.Uint160) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// ScriptHash calculates and returns script hash of ID.
|
// ScriptHash calculates and returns script hash of ID.
|
||||||
func (x *ID) ScriptHash() (util.Uint160, error) {
|
func (x *ID) ScriptHash() util.Uint160 {
|
||||||
return util.Uint160DecodeBytesBE(x.w[1:21])
|
res, _ := util.Uint160DecodeBytesBE(x.w[1:21])
|
||||||
|
return res
|
||||||
}
|
}
|
||||||
|
|
||||||
// WalletBytes returns FrostFS user ID as Neo3 wallet address in a binary format.
|
// WalletBytes returns FrostFS user ID as Neo3 wallet address in a binary format.
|
||||||
|
|
|
@ -51,8 +51,7 @@ func TestID_SetScriptHash(t *testing.T) {
|
||||||
func TestID_ScriptHash(t *testing.T) {
|
func TestID_ScriptHash(t *testing.T) {
|
||||||
userID := usertest.ID()
|
userID := usertest.ID()
|
||||||
|
|
||||||
scriptHash, err := userID.ScriptHash()
|
scriptHash := userID.ScriptHash()
|
||||||
require.NoError(t, err)
|
|
||||||
|
|
||||||
ownerAddress := userID.EncodeToString()
|
ownerAddress := userID.EncodeToString()
|
||||||
decodedScriptHash, err := address.StringToUint160(ownerAddress)
|
decodedScriptHash, err := address.StringToUint160(ownerAddress)
|
||||||
|
|
Loading…
Add table
Reference in a new issue