mirror of
https://github.com/tendermint/tendermint.git
synced 2026-09-03 06:37:14 +00:00
state/privval: no GetPubKey retry beyond the proposal/voting window (#6578)
Closes #5142
This commit is contained in:
@@ -50,6 +50,8 @@ func (sc *RetrySignerClient) GetPubKey(ctx context.Context) (crypto.PubKey, erro
|
||||
pk crypto.PubKey
|
||||
err error
|
||||
)
|
||||
|
||||
t := time.NewTimer(sc.timeout)
|
||||
for i := 0; i < sc.retries || sc.retries == 0; i++ {
|
||||
pk, err = sc.next.GetPubKey(ctx)
|
||||
if err == nil {
|
||||
@@ -59,7 +61,12 @@ func (sc *RetrySignerClient) GetPubKey(ctx context.Context) (crypto.PubKey, erro
|
||||
if _, ok := err.(*RemoteSignerError); ok {
|
||||
return nil, err
|
||||
}
|
||||
time.Sleep(sc.timeout)
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
return nil, ctx.Err()
|
||||
case <-t.C:
|
||||
t.Reset(sc.timeout)
|
||||
}
|
||||
}
|
||||
return nil, fmt.Errorf("exhausted all attempts to get pubkey: %w", err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user