mirror of
https://github.com/kaspanet/kaspad.git
synced 2025-03-30 15:08:33 +00:00
[NOD-1257] Disable difficulty adjustment on simnet (#862)
* [NOD-1257] Disable difficulty adjustment on simnet * [NOD-1257] Explictly set DisableDifficultyAdjustment everywhere
This commit is contained in:
parent
91f0fe5740
commit
aa9556aa59
@ -15,7 +15,7 @@ import (
|
||||
// block given its bluest parent.
|
||||
func (dag *BlockDAG) requiredDifficulty(bluestParent *blockNode, newBlockTime mstime.Time) uint32 {
|
||||
// Genesis block.
|
||||
if bluestParent == nil || bluestParent.blueScore < dag.difficultyAdjustmentWindowSize+1 {
|
||||
if dag.Params.DisableDifficultyAdjustment || bluestParent == nil || bluestParent.blueScore < dag.difficultyAdjustmentWindowSize+1 {
|
||||
return dag.powMaxBits
|
||||
}
|
||||
|
||||
|
@ -80,7 +80,7 @@ func TestCalcWork(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestDifficulty(t *testing.T) {
|
||||
params := dagconfig.SimnetParams
|
||||
params := dagconfig.MainnetParams
|
||||
params.K = 1
|
||||
params.DifficultyAdjustmentWindowSize = 264
|
||||
dag, teardownFunc, err := DAGSetup("TestDifficulty", true, Config{
|
||||
|
@ -178,6 +178,9 @@ type Params struct {
|
||||
|
||||
// EnableNonNativeSubnetworks enables non-native/coinbase transactions
|
||||
EnableNonNativeSubnetworks bool
|
||||
|
||||
// DisableDifficultyAdjustment determine whether to use difficulty
|
||||
DisableDifficultyAdjustment bool
|
||||
}
|
||||
|
||||
// NormalizeRPCServerAddress returns addr with the current network default
|
||||
@ -235,6 +238,8 @@ var MainnetParams = Params{
|
||||
|
||||
// EnableNonNativeSubnetworks enables non-native/coinbase transactions
|
||||
EnableNonNativeSubnetworks: false,
|
||||
|
||||
DisableDifficultyAdjustment: false,
|
||||
}
|
||||
|
||||
// RegressionNetParams defines the network parameters for the regression test
|
||||
@ -288,6 +293,8 @@ var RegressionNetParams = Params{
|
||||
|
||||
// EnableNonNativeSubnetworks enables non-native/coinbase transactions
|
||||
EnableNonNativeSubnetworks: false,
|
||||
|
||||
DisableDifficultyAdjustment: false,
|
||||
}
|
||||
|
||||
// TestnetParams defines the network parameters for the test Kaspa network.
|
||||
@ -339,6 +346,8 @@ var TestnetParams = Params{
|
||||
|
||||
// EnableNonNativeSubnetworks enables non-native/coinbase transactions
|
||||
EnableNonNativeSubnetworks: false,
|
||||
|
||||
DisableDifficultyAdjustment: false,
|
||||
}
|
||||
|
||||
// SimnetParams defines the network parameters for the simulation test Kaspa
|
||||
@ -394,6 +403,8 @@ var SimnetParams = Params{
|
||||
|
||||
// EnableNonNativeSubnetworks enables non-native/coinbase transactions
|
||||
EnableNonNativeSubnetworks: false,
|
||||
|
||||
DisableDifficultyAdjustment: true,
|
||||
}
|
||||
|
||||
// DevnetParams defines the network parameters for the development Kaspa network.
|
||||
@ -445,6 +456,8 @@ var DevnetParams = Params{
|
||||
|
||||
// EnableNonNativeSubnetworks enables non-native/coinbase transactions
|
||||
EnableNonNativeSubnetworks: false,
|
||||
|
||||
DisableDifficultyAdjustment: false,
|
||||
}
|
||||
|
||||
var (
|
||||
|
Loading…
x
Reference in New Issue
Block a user