Skip to content

Commit

Permalink
Re-Introduce checks in rewards_test.go
Browse files Browse the repository at this point in the history
  • Loading branch information
muXxer committed May 16, 2024
1 parent 23490ef commit 36a136a
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions tools/docker-network/tests/rewards_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,12 @@ func issueCandidacyAnnouncementsInBackground(ctx context.Context, d *dockertestf
fmt.Println("Issuing candidacy payload for account", wallet.BlockIssuer.AccountData.ID, "in epoch", epoch, "...")
committedAPI := d.DefaultWallet().Client.CommittedAPI()

// check if we are still in the epoch
latestAcceptedBlockSlot := d.NodeStatus("V1").LatestAcceptedBlockSlot
currentEpoch := committedAPI.TimeProvider().EpochFromSlot(latestAcceptedBlockSlot)

require.Equal(d.Testing, epoch, currentEpoch, "epoch mismatch")

// the candidacy announcement needs to be done before the nearing threshold
epochEndSlot := committedAPI.TimeProvider().EpochEnd(epoch)
maxRegistrationSlot := epochEndSlot - committedAPI.ProtocolParameters().EpochNearingThreshold() - 1
Expand Down Expand Up @@ -343,6 +349,13 @@ func issueValidationBlocksInBackground(ctx context.Context, d *dockertestframewo
return
}

// check if we are still in the slot
currentCommittedSlot := d.NodeStatus("V1").LatestCommitmentID.Slot()
if currentCommittedSlot >= slot {
// slot is already committed, no need to issue validation blocks
continue
}

ts := time.Now()
for validationBlockNr := range blocksPerSlot {
if ctx.Err() != nil {
Expand Down

0 comments on commit 36a136a

Please sign in to comment.