diff --git a/cmd/axelard/cmd/vald/tss/tss.go b/cmd/axelard/cmd/vald/tss/tss.go index e1e61971f..ccb23900a 100644 --- a/cmd/axelard/cmd/vald/tss/tss.go +++ b/cmd/axelard/cmd/vald/tss/tss.go @@ -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 } diff --git a/x/tss/keeper/grpc_query.go b/x/tss/keeper/grpc_query.go index 43be98a18..02b64c259 100644 --- a/x/tss/keeper/grpc_query.go +++ b/x/tss/keeper/grpc_query.go @@ -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() }