common: use tagged switch on chainID in func CopyConstants (#1579)

This commit is contained in:
wit liu 2025-10-08 12:28:17 +08:00 committed by GitHub
parent 077c4e6a45
commit 9b0a653698
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -128,14 +128,15 @@ func IsInBlacklist(address *Address) bool {
// It skips mainnet since the default value is from mainnet.
func CopyConstants(chainID uint64) {
var c *constant
if chainID == MaintnetConstant.chainID {
switch chainID {
case MaintnetConstant.chainID:
return
} else if chainID == TestnetConstant.chainID {
case TestnetConstant.chainID:
c = &TestnetConstant
IsTestnet = true
} else if chainID == DevnetConstant.chainID {
case DevnetConstant.chainID:
c = &DevnetConstant
} else { // local custom chain, it can have any chainID
default: // local custom chain, it can have any chainID
c = &localConstant
}