[#302] user: Make ScriptHash return no error

Signed-off-by: Ekaterina Lebedeva <ekaterina.lebedeva@yadro.com>
This commit is contained in:
Ekaterina Lebedeva 2025-01-27 12:00:58 +03:00
parent 9d7f7bd04f
commit 761d087b93
2 changed files with 4 additions and 4 deletions

View file

@ -73,8 +73,9 @@ func (x *ID) SetScriptHash(scriptHash util.Uint160) {
}
// ScriptHash calculates and returns script hash of ID.
func (x *ID) ScriptHash() (util.Uint160, error) {
return util.Uint160DecodeBytesBE(x.w[1:21])
func (x *ID) ScriptHash() util.Uint160 {
res, _ := util.Uint160DecodeBytesBE(x.w[1:21])
return res
}
// WalletBytes returns FrostFS user ID as Neo3 wallet address in a binary format.

View file

@ -51,8 +51,7 @@ func TestID_SetScriptHash(t *testing.T) {
func TestID_ScriptHash(t *testing.T) {
userID := usertest.ID()
scriptHash, err := userID.ScriptHash()
require.NoError(t, err)
scriptHash := userID.ScriptHash()
ownerAddress := userID.EncodeToString()
decodedScriptHash, err := address.StringToUint160(ownerAddress)