miner: wait for next block before running commit interrupt tests (#1450)

The results for the commit interrupt tests via new transactions channel were non-deterministic and used to fail sometimes. This was because we use `w.current` to calculate the delay which needs to be correct for the test to work as expected. It takes a while before `w.current` is updated to the next block (block 3 in this case). This PR adds a small delay so that we have the new block and delays are accurately calculated for the test to work.
This commit is contained in:
Manav Darji 2025-02-18 00:40:21 +05:30 committed by GitHub
parent 658bafe4db
commit 09f953a4bd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -876,6 +876,9 @@ func TestCommitInterruptExperimentBor_NewTxFlow(t *testing.T) {
head := <-chainHeadCh
// We skip the initial 2 blocks as the mining timings are a bit skewed up
if head.Block.NumberU64() == 2 {
// Wait until `w.current` is updated for next block (3)
time.Sleep(100 * time.Millisecond)
// Stop the miner so that worker assumes it's a sentry and not a validator
w.stop()