From bfaf527e670fb30ef41d84e8ddd971458dfa0236 Mon Sep 17 00:00:00 2001 From: rjl493456442 Date: Tue, 12 Apr 2022 16:34:07 +0800 Subject: [PATCH] core: fix benchmark panic (#24657) This PR fixes a few panics in the chain marker benchmarks. The root cause for panic is in chain marker the genesis header/block is not accessible, while it's expected to be obtained in tests. So this PR avoids touching genesis header at all to avoid panic. --- core/bench_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/bench_test.go b/core/bench_test.go index 7dd4839b4d11..3006e5513171 100644 --- a/core/bench_test.go +++ b/core/bench_test.go @@ -160,7 +160,7 @@ func genTxRing(naccounts int) func(int, *BlockGen) { // genUncles generates blocks with two uncle headers. func genUncles(i int, gen *BlockGen) { - if i >= 6 { + if i >= 7 { b2 := gen.PrevBlock(i - 6).Header() b2.Extra = []byte("foo") gen.AddUncle(b2)