From 36a136a610a693ce3a019bb9b102ffef53fc35be Mon Sep 17 00:00:00 2001 From: muXxer Date: Thu, 16 May 2024 14:45:24 +0200 Subject: [PATCH] Re-Introduce checks in rewards_test.go --- tools/docker-network/tests/rewards_test.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tools/docker-network/tests/rewards_test.go b/tools/docker-network/tests/rewards_test.go index b779b5a6a..3879b359a 100644 --- a/tools/docker-network/tests/rewards_test.go +++ b/tools/docker-network/tests/rewards_test.go @@ -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 @@ -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 {