mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-06-29 01:37:37 +00:00
cmd, common, eth: copy constants after get chain id
This commit is contained in:
parent
6f22270ba4
commit
2a2711ad64
6 changed files with 30 additions and 25 deletions
|
|
@ -1447,7 +1447,6 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *ethconfig.Config) {
|
|||
if ctx.Bool(XDCTestnetFlag.Name) {
|
||||
cfg.NetworkId = 51
|
||||
}
|
||||
common.CopyConstans(cfg.NetworkId)
|
||||
|
||||
if ctx.IsSet(CacheFlag.Name) || ctx.IsSet(CacheDatabaseFlag.Name) {
|
||||
cfg.DatabaseCache = ctx.Int(CacheFlag.Name) * ctx.Int(CacheDatabaseFlag.Name) / 100
|
||||
|
|
|
|||
|
|
@ -143,8 +143,8 @@ var (
|
|||
LendingRegistrationSMC = MaintnetConstant.lendingRegistrationSMC
|
||||
LendingRegistrationSMCTestnet = MaintnetConstant.lendingRegistrationSMCTestnet
|
||||
|
||||
ignoreSignerCheckBlockArray = map[uint64]struct{}{}
|
||||
blacklist = map[Address]struct{}{}
|
||||
ignoreSignerCheckBlockArray = MaintnetConstant.ignoreSignerCheckBlockArray
|
||||
blacklist = MaintnetConstant.blacklist
|
||||
)
|
||||
|
||||
func IsIgnoreSignerCheckBlock(blockNumber uint64) bool {
|
||||
|
|
@ -160,12 +160,13 @@ func IsInBlacklist(address *Address) bool {
|
|||
return ok
|
||||
}
|
||||
|
||||
// CopyConstans only handles testnet, devnet, local. It does not
|
||||
// handles mainnet since the default value is from mainnet.
|
||||
func CopyConstans(chainID uint64) {
|
||||
var c *constant
|
||||
if chainID == MaintnetConstant.chainID {
|
||||
c = &MaintnetConstant
|
||||
} else if chainID == TestnetConstant.chainID {
|
||||
if chainID == TestnetConstant.chainID {
|
||||
c = &TestnetConstant
|
||||
IsTestnet = true
|
||||
} else if chainID == DevnetConstant.chainID {
|
||||
c = &DevnetConstant
|
||||
} else if chainID == localConstant.chainID {
|
||||
|
|
|
|||
|
|
@ -143,8 +143,8 @@ var (
|
|||
LendingRegistrationSMC = MaintnetConstant.lendingRegistrationSMC
|
||||
LendingRegistrationSMCTestnet = MaintnetConstant.lendingRegistrationSMCTestnet
|
||||
|
||||
ignoreSignerCheckBlockArray = map[uint64]struct{}{}
|
||||
blacklist = map[Address]struct{}{}
|
||||
ignoreSignerCheckBlockArray = MaintnetConstant.ignoreSignerCheckBlockArray
|
||||
blacklist = MaintnetConstant.blacklist
|
||||
)
|
||||
|
||||
func IsIgnoreSignerCheckBlock(blockNumber uint64) bool {
|
||||
|
|
@ -160,12 +160,13 @@ func IsInBlacklist(address *Address) bool {
|
|||
return ok
|
||||
}
|
||||
|
||||
// CopyConstans only handles testnet, devnet, local. It does not
|
||||
// handles mainnet since the default value is from mainnet.
|
||||
func CopyConstans(chainID uint64) {
|
||||
var c *constant
|
||||
if chainID == MaintnetConstant.chainID {
|
||||
c = &MaintnetConstant
|
||||
} else if chainID == TestnetConstant.chainID {
|
||||
if chainID == TestnetConstant.chainID {
|
||||
c = &TestnetConstant
|
||||
IsTestnet = true
|
||||
} else if chainID == DevnetConstant.chainID {
|
||||
c = &DevnetConstant
|
||||
} else if chainID == localConstant.chainID {
|
||||
|
|
|
|||
|
|
@ -143,8 +143,8 @@ var (
|
|||
LendingRegistrationSMC = MaintnetConstant.lendingRegistrationSMC
|
||||
LendingRegistrationSMCTestnet = MaintnetConstant.lendingRegistrationSMCTestnet
|
||||
|
||||
ignoreSignerCheckBlockArray = map[uint64]struct{}{}
|
||||
blacklist = map[Address]struct{}{}
|
||||
ignoreSignerCheckBlockArray = MaintnetConstant.ignoreSignerCheckBlockArray
|
||||
blacklist = MaintnetConstant.blacklist
|
||||
)
|
||||
|
||||
func IsIgnoreSignerCheckBlock(blockNumber uint64) bool {
|
||||
|
|
@ -160,12 +160,13 @@ func IsInBlacklist(address *Address) bool {
|
|||
return ok
|
||||
}
|
||||
|
||||
// CopyConstans only handles testnet, devnet, local. It does not
|
||||
// handles mainnet since the default value is from mainnet.
|
||||
func CopyConstans(chainID uint64) {
|
||||
var c *constant
|
||||
if chainID == MaintnetConstant.chainID {
|
||||
c = &MaintnetConstant
|
||||
} else if chainID == TestnetConstant.chainID {
|
||||
if chainID == TestnetConstant.chainID {
|
||||
c = &TestnetConstant
|
||||
IsTestnet = true
|
||||
} else if chainID == DevnetConstant.chainID {
|
||||
c = &DevnetConstant
|
||||
} else if chainID == localConstant.chainID {
|
||||
|
|
|
|||
|
|
@ -143,8 +143,8 @@ var (
|
|||
LendingRegistrationSMC = MaintnetConstant.lendingRegistrationSMC
|
||||
LendingRegistrationSMCTestnet = MaintnetConstant.lendingRegistrationSMCTestnet
|
||||
|
||||
ignoreSignerCheckBlockArray = map[uint64]struct{}{}
|
||||
blacklist = map[Address]struct{}{}
|
||||
ignoreSignerCheckBlockArray = MaintnetConstant.ignoreSignerCheckBlockArray
|
||||
blacklist = MaintnetConstant.blacklist
|
||||
)
|
||||
|
||||
func IsIgnoreSignerCheckBlock(blockNumber uint64) bool {
|
||||
|
|
@ -160,12 +160,13 @@ func IsInBlacklist(address *Address) bool {
|
|||
return ok
|
||||
}
|
||||
|
||||
// CopyConstans only handles testnet, devnet, local. It does not
|
||||
// handles mainnet since the default value is from mainnet.
|
||||
func CopyConstans(chainID uint64) {
|
||||
var c *constant
|
||||
if chainID == MaintnetConstant.chainID {
|
||||
c = &MaintnetConstant
|
||||
} else if chainID == TestnetConstant.chainID {
|
||||
if chainID == TestnetConstant.chainID {
|
||||
c = &TestnetConstant
|
||||
IsTestnet = true
|
||||
} else if chainID == DevnetConstant.chainID {
|
||||
c = &DevnetConstant
|
||||
} else if chainID == localConstant.chainID {
|
||||
|
|
|
|||
|
|
@ -131,16 +131,18 @@ func New(ctx *node.ServiceContext, config *ethconfig.Config, XDCXServ *XDCx.XDCX
|
|||
return nil, genesisErr
|
||||
}
|
||||
|
||||
networkID := config.NetworkId
|
||||
if networkID == 0 {
|
||||
networkID = chainConfig.ChainId.Uint64()
|
||||
}
|
||||
common.CopyConstans(networkID)
|
||||
|
||||
log.Info(strings.Repeat("-", 153))
|
||||
for _, line := range strings.Split(chainConfig.Description(), "\n") {
|
||||
log.Info(line)
|
||||
}
|
||||
log.Info(strings.Repeat("-", 153))
|
||||
|
||||
networkID := config.NetworkId
|
||||
if networkID == 0 {
|
||||
networkID = chainConfig.ChainId.Uint64()
|
||||
}
|
||||
eth := &Ethereum{
|
||||
config: config,
|
||||
chainDb: chainDb,
|
||||
|
|
|
|||
Loading…
Reference in a new issue