Skip to content

Commit

Permalink
Fix nil in reorg timer
Browse files Browse the repository at this point in the history
  • Loading branch information
lukaszcl committed Jun 10, 2024
1 parent 008c904 commit 98533d4
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions integration-tests/testsetups/ocr.go
Original file line number Diff line number Diff line change
Expand Up @@ -581,18 +581,18 @@ func (o *OCRSoakTest) testLoop(testDuration time.Duration, newValue int) {

// Schedule blockchain re-org if needed
// Reorg only avaible for Simulated Geth
var reorgTimer *time.Timer
var reorgDelay time.Duration
var reorgCh <-chan time.Time
n := o.Config.GetNetworkConfig()
if n.IsSimulatedGethSelected() && n.GethReorgConfig.Enabled {
var reorgDelay time.Duration
if n.GethReorgConfig.DelayCreate.Duration > testDuration {
// This may happen when test is resumed and the reorg delay is longer than the time left
o.log.Warn().Msg("Reorg delay is longer than test duration, reorg scheduled immediately")
reorgDelay = 0
} else {
reorgDelay = n.GethReorgConfig.DelayCreate.Duration
}
reorgTimer = time.NewTimer(reorgDelay)
reorgCh = time.After(reorgDelay)
}

for {
Expand Down Expand Up @@ -630,7 +630,7 @@ func (o *OCRSoakTest) testLoop(testDuration time.Duration, newValue int) {
lastValue = newValue

// Schedule blockchain re-org if needed
case <-reorgTimer.C:
case <-reorgCh:
if !o.reorgHappened {
o.startBlockchainReorg(o.Config.GetNetworkConfig().GethReorgConfig.Depth)
}
Expand Down

0 comments on commit 98533d4

Please sign in to comment.