forked from iotexproject/iotex-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgenesis.go
41 lines (39 loc) · 1.08 KB
/
genesis.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package testutil
import "github.com/iotexproject/iotex-core/v2/blockchain/genesis"
// NormalizeGenesisHeights normalizes the heights in the genesis config
// it's used in tests to make sure the heights are monotonically increasing
func NormalizeGenesisHeights(g *genesis.Blockchain) {
heights := []*uint64{
&g.PacificBlockHeight,
&g.AleutianBlockHeight,
&g.BeringBlockHeight,
&g.CookBlockHeight,
&g.DardanellesBlockHeight,
&g.DaytonaBlockHeight,
&g.EasterBlockHeight,
&g.FbkMigrationBlockHeight,
&g.FairbankBlockHeight,
&g.GreenlandBlockHeight,
&g.HawaiiBlockHeight,
&g.IcelandBlockHeight,
&g.JutlandBlockHeight,
&g.KamchatkaBlockHeight,
&g.LordHoweBlockHeight,
&g.MidwayBlockHeight,
&g.NewfoundlandBlockHeight,
&g.OkhotskBlockHeight,
&g.PalauBlockHeight,
&g.QuebecBlockHeight,
&g.RedseaBlockHeight,
&g.SumatraBlockHeight,
&g.TsunamiBlockHeight,
&g.UpernavikBlockHeight,
&g.VanuatuBlockHeight,
&g.ToBeEnabledBlockHeight,
}
for i := len(heights) - 2; i >= 0; i-- {
if *(heights[i]) > *(heights[i+1]) {
*(heights[i]) = *(heights[i+1])
}
}
}