bridge/pkg/processor: ignore observations while waiting for guardian set fetch

Fixes crash https://gist.github.com/leoluk/17d77fef7c0fd44dd6c3fe3e65bb23a7.
This commit is contained in:
Leo 2021-01-21 14:25:27 +01:00
parent b7c6eb7f3c
commit 76cb95c51b
1 changed files with 5 additions and 0 deletions

View File

@ -26,6 +26,11 @@ func (p *Processor) handleLockup(ctx context.Context, k *common.ChainLock) {
zap.Time("timestamp", k.Timestamp), zap.Time("timestamp", k.Timestamp),
) )
if p.gs == nil {
p.logger.Warn("received observation, but we don't know the guardian set yet")
return
}
us, ok := p.gs.KeyIndex(p.ourAddr) us, ok := p.gs.KeyIndex(p.ourAddr)
if !ok { if !ok {
p.logger.Error("we're not in the guardian set - refusing to sign", p.logger.Error("we're not in the guardian set - refusing to sign",