Skip to content

Commit

Permalink
chore: fix failing tests
Browse files Browse the repository at this point in the history
Signed-off-by: Ivan Ivanov <ivanivanov.ii726@gmail.com>
  • Loading branch information
0xivanov committed Aug 1, 2024
1 parent 31597cd commit ec90ef7
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 14 deletions.
11 changes: 11 additions & 0 deletions key_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
19 changes: 5 additions & 14 deletions tck/methods/key.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit ec90ef7

Please sign in to comment.