diff --git a/eth/ethconfig/config.go b/eth/ethconfig/config.go index 6ab43891f7..9f64b09ac5 100644 --- a/eth/ethconfig/config.go +++ b/eth/ethconfig/config.go @@ -88,7 +88,7 @@ var Defaults = Config{ Miner: miner.Config{ GasCeil: 8000000, GasPrice: big.NewInt(params.GWei), - Recommit: 3 * time.Second, + Recommit: 125 * time.Second, }, TxPool: core.DefaultTxPoolConfig, RPCGasCap: 50000000, diff --git a/miner/worker.go b/miner/worker.go index c3a5e1c9ba..1da8a529d7 100644 --- a/miner/worker.go +++ b/miner/worker.go @@ -389,24 +389,27 @@ func (w *worker) close() { // recalcRecommit recalculates the resubmitting interval upon feedback. func recalcRecommit(minRecommit, prev time.Duration, target float64, inc bool) time.Duration { - var ( - prevF = float64(prev.Nanoseconds()) - next float64 - ) - if inc { - next = prevF*(1-intervalAdjustRatio) + intervalAdjustRatio*(target+intervalAdjustBias) - max := float64(maxRecommitInterval.Nanoseconds()) - if next > max { - next = max - } - } else { - next = prevF*(1-intervalAdjustRatio) + intervalAdjustRatio*(target-intervalAdjustBias) - min := float64(minRecommit.Nanoseconds()) - if next < min { - next = min - } - } - return time.Duration(int64(next)) + // var ( + // prevF = float64(prev.Nanoseconds()) + // next float64 + // ) + // if inc { + // next = prevF*(1-intervalAdjustRatio) + intervalAdjustRatio*(target+intervalAdjustBias) + // max := float64(maxRecommitInterval.Nanoseconds()) + // if next > max { + // next = max + // } + // } else { + // next = prevF*(1-intervalAdjustRatio) + intervalAdjustRatio*(target-intervalAdjustBias) + // min := float64(minRecommit.Nanoseconds()) + // if next < min { + // next = min + // } + // } + // log.Info("Recalc Commit", "Prev", prev, "Next", next) + + //returning the Same prev value to keep the recommit interval constant + return time.Duration(int64(prev)) } // newWorkLoop is a standalone goroutine to submit new sealing work upon received events. diff --git a/miner/worker_test.go b/miner/worker_test.go index dd029433b8..20dc3238da 100644 --- a/miner/worker_test.go +++ b/miner/worker_test.go @@ -434,10 +434,15 @@ func testRegenerateMiningBlock(t *testing.T, chainConfig *params.ChainConfig, en } func TestAdjustIntervalEthash(t *testing.T) { + // Skipping this test as recommit interval would remain constant + t.Skip() testAdjustInterval(t, ethashChainConfig, ethash.NewFaker()) } func TestAdjustIntervalClique(t *testing.T) { + + // Skipping this test as recommit interval would remain constant + t.Skip() testAdjustInterval(t, cliqueChainConfig, clique.New(cliqueChainConfig.Clique, rawdb.NewMemoryDatabase())) }