github.com/kotalco/kotal@v0.3.0/apis/ethereum/v1alpha1/genesis_defaulting.go (about) 1 package v1alpha1 2 3 // Default defaults genesis block parameters 4 func (g *Genesis) Default() { 5 if g.Coinbase == "" { 6 g.Coinbase = DefaultCoinbase 7 } 8 9 if g.Difficulty == "" { 10 g.Difficulty = DefaultDifficulty 11 } 12 13 if g.Forks == nil { 14 g.Forks = &Forks{} 15 } 16 17 if g.MixHash == "" { 18 g.MixHash = DefaultMixHash 19 } 20 21 if g.GasLimit == "" { 22 g.GasLimit = DefaultGasLimit 23 } 24 25 if g.Nonce == "" { 26 g.Nonce = DefaultNonce 27 } 28 29 if g.Timestamp == "" { 30 g.Timestamp = DefaultTimestamp 31 } 32 33 if g.Clique != nil { 34 if g.Clique.BlockPeriod == 0 { 35 g.Clique.BlockPeriod = DefaultCliqueBlockPeriod 36 } 37 if g.Clique.EpochLength == 0 { 38 g.Clique.EpochLength = DefaultCliqueEpochLength 39 } 40 } 41 42 if g.IBFT2 != nil { 43 if g.IBFT2.BlockPeriod == 0 { 44 g.IBFT2.BlockPeriod = DefaultIBFT2BlockPeriod 45 } 46 if g.IBFT2.EpochLength == 0 { 47 g.IBFT2.EpochLength = DefaultIBFT2EpochLength 48 } 49 if g.IBFT2.RequestTimeout == 0 { 50 g.IBFT2.RequestTimeout = DefaultIBFT2RequestTimeout 51 } 52 if g.IBFT2.MessageQueueLimit == 0 { 53 g.IBFT2.MessageQueueLimit = DefaultIBFT2MessageQueueLimit 54 } 55 if g.IBFT2.DuplicateMessageLimit == 0 { 56 g.IBFT2.DuplicateMessageLimit = DefaultIBFT2DuplicateMessageLimit 57 } 58 if g.IBFT2.FutureMessagesLimit == 0 { 59 g.IBFT2.FutureMessagesLimit = DefaultIBFT2FutureMessagesLimit 60 } 61 if g.IBFT2.FutureMessagesMaxDistance == 0 { 62 g.IBFT2.FutureMessagesMaxDistance = DefaultIBFT2FutureMessagesMaxDistance 63 } 64 } 65 }