Skip to content

Commit

Permalink
fix discovery obs issue
Browse files Browse the repository at this point in the history
  • Loading branch information
dimkouv committed Nov 6, 2024
1 parent 37ea696 commit dda3674
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions commit/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -259,6 +264,7 @@ func (p *Plugin) Observation(
obs := Observation{
MerkleRootObs: merkleRootObs,
TokenPriceObs: tokenPriceObs,
DiscoveryObs: discoveryObs,
ChainFeeObs: chainFeeObs,
FChain: p.ObserveFChain(),
}
Expand Down

0 comments on commit dda3674

Please sign in to comment.