diff --git a/config/config.go b/config/config.go index cefa8245..585d7514 100644 --- a/config/config.go +++ b/config/config.go @@ -55,6 +55,7 @@ type Config struct { Miner bool `long:"miner" description:"Enable miner module"` Generate bool `long:"generate" description:"Generate (mine) coins using the CPU"` GenerateOnTx bool `long:"generateontx" description:"Generate (mine) coins using the CPU when there is a new transaction"` + GenerateNoDevGap bool `long:"generatenodevgap" description:"Generate (mine) coins using the CPU on develop mode whithout gap"` MiningAddrs []string `long:"miningaddr" description:"Add the specified payment address to the list of addresses to use for generated blocks -- At least one address is required if the generate option is set"` MiningTimeOffset int `long:"miningtimeoffset" description:"Offset the mining timestamp of a block by this many seconds (positive values are in the past)"` BlockMinSize uint32 `long:"blockminsize" description:"Mininum block size in bytes to be used when creating a block"` @@ -142,7 +143,7 @@ type Config struct { AutoCollectEvm bool `long:"autocollectevm" description:"auto collect utxo to evm"` // TODO: It will soon be discarded in the near future - DevSnapSync bool `long:"dev_snapsync" description:"Enable snap sync for P2P that only exist in development mode"` + DevSnapSync bool `long:"devsnapsync" description:"Enable snap sync for P2P that only exist in development mode"` } func (c *Config) GetMinningAddrs() []types.Address { diff --git a/services/common/flags.go b/services/common/flags.go index 4b4d0cf2..d6008828 100644 --- a/services/common/flags.go +++ b/services/common/flags.go @@ -646,6 +646,12 @@ var ( Value: true, Destination: &cfg.DevSnapSync, }, + &cli.BoolFlag{ + Name: "generatenodevgap", + Usage: "Generate (mine) coins using the CPU on develop mode whithout gap", + Value: true, + Destination: &cfg.GenerateNoDevGap, + }, } ) diff --git a/services/miner/cpuworker.go b/services/miner/cpuworker.go index b663377a..71330757 100644 --- a/services/miner/cpuworker.go +++ b/services/miner/cpuworker.go @@ -316,7 +316,7 @@ out: } if params.ActiveNetParams.Params.IsDevelopDiff() { w.miner.updateBlockTemplate(true) - if !w.miner.NoDevelopGap { + if !w.miner.cfg.GenerateNoDevGap { time.Sleep(params.ActiveNetParams.Params.TargetTimePerBlock) } } diff --git a/testutils/mocknode.go b/testutils/mocknode.go index c7790d13..646a00b3 100644 --- a/testutils/mocknode.go +++ b/testutils/mocknode.go @@ -47,6 +47,7 @@ func DefaultConfig(pb *testprivatekey.Builder) (*config.Config, error) { cfg.SubmitNoSynced = true cfg.AcctMode = true cfg.EVMEnv = "--nodiscover --v5disc=false --rpc.allow-unprotected-txs" + cfg.GenerateNoDevGap = true params.ActiveNetParams = ¶ms.PrivNetParam coinbasePKHex := pb.GetHex(testprivatekey.CoinbaseIdx) @@ -177,7 +178,6 @@ func (mn *MockNode) setup() error { log.Info("Import default key", "addr", account.String()) - mn.Node().GetQitmeerFull().GetMiner().NoDevelopGap = true params.ActiveNetParams.PowConfig.DifficultyMode = pow.DIFFICULTY_MODE_DEVELOP return nil }