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.
pull/24692/head
rjl493456442 3 years ago committed by GitHub
parent c40943a167
commit 195c979168
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      core/bench_test.go

@ -160,7 +160,7 @@ func genTxRing(naccounts int) func(int, *BlockGen) {
// genUncles generates blocks with two uncle headers. // genUncles generates blocks with two uncle headers.
func genUncles(i int, gen *BlockGen) { func genUncles(i int, gen *BlockGen) {
if i >= 6 { if i >= 7 {
b2 := gen.PrevBlock(i - 6).Header() b2 := gen.PrevBlock(i - 6).Header()
b2.Extra = []byte("foo") b2.Extra = []byte("foo")
gen.AddUncle(b2) gen.AddUncle(b2)

Loading…
Cancel
Save