From dda36749e0e8224f3e35f8c4ee0cd336053dfa00 Mon Sep 17 00:00:00 2001 From: dimkouv Date: Wed, 6 Nov 2024 15:22:35 +0200 Subject: [PATCH] fix discovery obs issue --- commit/plugin.go | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/commit/plugin.go b/commit/plugin.go index 9e2b1935d..a63f2b4ec 100644 --- a/commit/plugin.go +++ b/commit/plugin.go @@ -209,13 +209,18 @@ func (p *Plugin) ObservationQuorum( func (p *Plugin) Observation( ctx context.Context, outCtx ocr3types.OutcomeContext, q types.Query, ) (types.Observation, error) { - // If the contracts are not initialized then only submit contracts discovery related observation. - if !p.contractsInitialized.Load() && p.discoveryProcessor != nil { - discoveryObs, err := p.discoveryProcessor.Observation(ctx, dt.Outcome{}, dt.Query{}) + var discoveryObs dt.Observation + var err error + + if p.discoveryProcessor != nil { + discoveryObs, err = p.discoveryProcessor.Observation(ctx, dt.Outcome{}, dt.Query{}) if err != nil { p.lggr.Errorw("failed to discover contracts", "err", err) } + } + // If the contracts are not initialized then only submit contracts discovery related observation. + if !p.contractsInitialized.Load() && p.discoveryProcessor != nil { obs := Observation{DiscoveryObs: discoveryObs} encoded, err := obs.Encode() if err != nil { @@ -259,6 +264,7 @@ func (p *Plugin) Observation( obs := Observation{ MerkleRootObs: merkleRootObs, TokenPriceObs: tokenPriceObs, + DiscoveryObs: discoveryObs, ChainFeeObs: chainFeeObs, FChain: p.ObserveFChain(), }