func CopyConstants choose local chain if unknown chainID

This commit is contained in:
wanwiset25 2025-09-14 15:21:26 +04:00
parent a1e5a98377
commit ae696dc547
3 changed files with 15 additions and 7 deletions

View file

@ -231,6 +231,14 @@ func (w *wizard) makeGenesis() {
genesis.Config.XDPoS.V2.CurrentConfig.CertThreshold = w.readDefaultFloat(0.667)
}
genesis.Config.XDPoS.V2.CurrentConfig.MaxMasternodes = 108
//TODO: config to add after rewards upgrade enabled
// genesis.Config.XDPoS.V2.CurrentConfig.MaxProtectornodes
// genesis.Config.XDPoS.V2.CurrentConfig.MaxObservernodes
// genesis.Config.XDPoS.V2.CurrentConfig.MinProtectornodes
// genesis.Config.XDPoS.V2.CurrentConfig.MasternodeReward
// genesis.Config.XDPoS.V2.CurrentConfig.ProtectornodeReward
// genesis.Config.XDPoS.V2.CurrentConfig.ObservernodeReward
genesis.Config.XDPoS.V2.AllConfigs[0] = genesis.Config.XDPoS.V2.CurrentConfig
fmt.Println()

View file

@ -128,15 +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 == TestnetConstant.chainID {
if chainID == MaintnetConstant.chainID {
return
} else if chainID == TestnetConstant.chainID {
c = &TestnetConstant
IsTestnet = true
} else if chainID == DevnetConstant.chainID {
c = &DevnetConstant
} else if chainID == localConstant.chainID {
} else { // local custom chain, it can have any chainID
c = &localConstant
} else {
return
}
MaxMasternodesV2 = c.maxMasternodesV2

View file

@ -28,9 +28,9 @@ var localConstant = constant{
tipXDCXReceiverDisable: big.NewInt(0),
eip1559Block: big.NewInt(0),
cancunBlock: big.NewInt(0),
tipUpgradeReward: big.NewInt(0),
tipUpgradePenalty: big.NewInt(0),
tipEpochHalving: big.NewInt(0),
tipUpgradeReward: big.NewInt(999999999),
tipUpgradePenalty: big.NewInt(999999999),
tipEpochHalving: big.NewInt(999999999),
trc21IssuerSMC: HexToAddress("0x8c0faeb5C6bEd2129b8674F262Fd45c4e9468bee"),
xdcxListingSMC: HexToAddress("0xDE34dD0f536170993E8CFF639DdFfCF1A85D3E53"),