Skip to content

Commit

Permalink
fix(tss): fix validator key query (#1461)
Browse files Browse the repository at this point in the history
  • Loading branch information
milapsheth authored May 3, 2022
1 parent 4257f89 commit 1b1996e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
4 changes: 4 additions & 0 deletions cmd/axelard/cmd/vald/tss/tss.go
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,10 @@ func (mgr *Mgr) RefreshKeys(ctx context.Context) error {

mgr.Keys = make(map[string][][]byte, len(valKeysResponse.Keys))
for keyID, keys := range valKeysResponse.Keys {
if len(keys.Keys) == 0 {
return fmt.Errorf("received no keys for key id %s", keyID)
}

mgr.Logger.Info(fmt.Sprintf("retrieved key %s", keyID))
mgr.Keys[keyID] = keys.Keys
}
Expand Down
10 changes: 5 additions & 5 deletions x/tss/keeper/grpc_query.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,15 +114,15 @@ func (q Querier) getSerializedMultisigKeys(ctx sdk.Context, key exported.Key, va
return nil, false
}

pubkeys, ok := q.keeper.GetMultisigPubKeysByValidator(ctx, key.ID, valAddress)
if !ok {
pubKeys, ok := q.keeper.GetMultisigPubKeysByValidator(ctx, key.ID, valAddress)
if !ok || len(pubKeys) == 0 {
return nil, false
}

valKeys := make([][]byte, len(pubkeys))
valKeys := make([][]byte, len(pubKeys))

for i, pubkey := range pubkeys {
wrappedKey := btcec.PublicKey(pubkey)
for i, pubKey := range pubKeys {
wrappedKey := btcec.PublicKey(pubKey)
valKeys[i] = wrappedKey.SerializeCompressed()
}

Expand Down

0 comments on commit 1b1996e

Please sign in to comment.