From 73710ff3c52d85664df0dc1b7e85883a0e172670 Mon Sep 17 00:00:00 2001 From: Felix Lange Date: Fri, 18 Jul 2025 13:17:25 +0200 Subject: [PATCH] params: move some code around --- params/chainparam.go | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/params/chainparam.go b/params/chainparam.go index 36a2a89712..9e20c03348 100644 --- a/params/chainparam.go +++ b/params/chainparam.go @@ -10,13 +10,24 @@ import ( // ChainID var ChainID = Define(T[*big.Int]{ - Name: "chainId", - Validate: func(v *big.Int, cfg *Config2) error { - if v.Sign() <= 0 { - return fmt.Errorf("invalid chainID value %v", v) - } - return nil - }, + Name: "chainId", + Optional: false, + Validate: validateChainID, +}) + +func validateChainID(v *big.Int, cfg *Config2) error { + if v.Sign() <= 0 { + return fmt.Errorf("invalid chainID value %v", v) + } + return nil +} + +// DAOForkSupport is the chain parameter that configures the DAO fork. +// true=supports or false=opposes the fork. +// The default value is true. +var DAOForkSupport = Define(T[bool]{ + Optional: true, + Default: true, }) // TerminalTotalDifficulty (TTD) is the total difficulty value where @@ -56,11 +67,3 @@ func validateBlobSchedule(schedule map[forks.Fork]BlobConfig, cfg *Config2) erro } return nil } - -// DAOForkSupport is the chain parameter that configures the DAO fork. -// true=supports or false=opposes the fork. -// The default value is true. -var DAOForkSupport = Define(T[bool]{ - Optional: true, - Default: true, -})