From ec90ef79f00f3b46912515930cc0f61d8a85254f Mon Sep 17 00:00:00 2001 From: Ivan Ivanov Date: Tue, 30 Jul 2024 09:46:58 +0300 Subject: [PATCH] chore: fix failing tests Signed-off-by: Ivan Ivanov --- key_list.go | 11 +++++++++++ tck/methods/key.go | 19 +++++-------------- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/key_list.go b/key_list.go index 125aad50..b145702e 100644 --- a/key_list.go +++ b/key_list.go @@ -165,3 +165,14 @@ func _KeyListFromProtobuf(pb *services.KeyList) (KeyList, error) { threshold: -1, }, nil } + +func KeyListFromBytes(bytes []byte) (KeyList, error) { + protoKey := &services.KeyList{} + + err := protobuf.Unmarshal(bytes, protoKey) + if err != nil { + return KeyList{}, err + } + + return _KeyListFromProtobuf(protoKey) +} diff --git a/tck/methods/key.go b/tck/methods/key.go index 55e36f78..ac39b68d 100644 --- a/tck/methods/key.go +++ b/tck/methods/key.go @@ -4,7 +4,6 @@ import ( "context" "encoding/hex" "errors" - "strings" "github.com/hashgraph/hedera-sdk-go/tck/param" "github.com/hashgraph/hedera-sdk-go/tck/response" @@ -90,19 +89,11 @@ func processKeyRecursively(params param.KeyParams, response *response.GenerateKe if err != nil { return "", err } - if strings.Contains(keyStr, "326d") { - key, err := getKeyListFromString(keyStr) - if err != nil { - return "", err - } - keyList.Add(key) - } else { - key, err := getKeyFromString(keyStr) - if err != nil { - return "", err - } - keyList.Add(key) + key, err := getKeyFromString(keyStr) + if err != nil { + return "", err } + keyList.Add(key) } if params.Type == param.THRESHOLD_KEY { keyList.SetThreshold(params.Threshold) @@ -149,7 +140,7 @@ func getKeyListFromString(keyStr string) (hedera.Key, error) { return hedera.KeyList{}, err } - return hedera.KeyFromBytes(bytes) + return hedera.KeyListFromBytes(bytes) } func getKeyFromString(keyStr string) (hedera.Key, error) {