From 761d087b93bcf0bfb2775fd4401f2dbc32625e86 Mon Sep 17 00:00:00 2001 From: Ekaterina Lebedeva Date: Mon, 27 Jan 2025 12:00:58 +0300 Subject: [PATCH] [#302] user: Make `ScriptHash` return no error Signed-off-by: Ekaterina Lebedeva --- user/id.go | 5 +++-- user/id_test.go | 3 +-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/user/id.go b/user/id.go index 2d64d43c..d185992f 100644 --- a/user/id.go +++ b/user/id.go @@ -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. diff --git a/user/id_test.go b/user/id_test.go index afeb7465..c517dc5d 100644 --- a/user/id_test.go +++ b/user/id_test.go @@ -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)