Skip to content

Commit

Permalink
update the cache used for LatestRoundRequested (#503) (#504)
Browse files Browse the repository at this point in the history
  • Loading branch information
augustbleeds committed Aug 5, 2024
1 parent ea0176c commit 837a7dc
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 14 deletions.
9 changes: 2 additions & 7 deletions relayer/pkg/chainlink/ocr2/contract_reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ func (c *contractReader) LatestTransmissionDetails(
return
}

// round will never be requested on Starknet so we return 0 values
func (c *contractReader) LatestRoundRequested(
ctx context.Context,
lookback time.Duration,
Expand All @@ -110,15 +111,9 @@ func (c *contractReader) LatestRoundRequested(
round uint8,
err error,
) {
transmissionDetails, err := c.reader.LatestTransmissionDetails(ctx, c.address)
if err != nil {
err = fmt.Errorf("couldn't get transmission details: %w", err)
}

configDigest = transmissionDetails.Digest
configDigest = types.ConfigDigest{}
epoch = 0
round = 0

return
}

Expand Down
8 changes: 1 addition & 7 deletions relayer/pkg/chainlink/ocr2/transmissions_cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,13 +130,7 @@ func (c *transmissionsCache) LatestRoundRequested(
round uint8,
err error,
) {
c.tdLock.RLock()
defer c.tdLock.RUnlock()
configDigest = c.transmissionDetails.Digest
epoch = c.transmissionDetails.Epoch
round = c.transmissionDetails.Round
err = c.assertTransmissionsNotStale()
return
return c.reader.LatestRoundRequested(ctx, lookback)
}

func (c *transmissionsCache) assertTransmissionsNotStale() error {
Expand Down

0 comments on commit 837a7dc

Please sign in to comment.