mirror of
https://github.com/kaspanet/kaspad.git
synced 2025-03-30 15:08:33 +00:00
Rename FixedSubsidySwitchHashRateDifference to FixedSubsidySwitchHashRateThreshold and set its value to 150GH/s. (#1837)
This commit is contained in:
parent
ff72568d6b
commit
131cd3357e
@ -206,7 +206,7 @@ func (f *factory) NewConsensus(config *Config, db infrastructuredatabase.Databas
|
||||
config.CoinbasePayloadScriptPublicKeyMaxLength,
|
||||
config.GenesisHash,
|
||||
config.FixedSubsidySwitchPruningPointInterval,
|
||||
config.FixedSubsidySwitchHashRateDifference,
|
||||
config.FixedSubsidySwitchHashRateThreshold,
|
||||
dagTraversalManager,
|
||||
ghostdagDataStore,
|
||||
acceptanceDataStore,
|
||||
|
@ -49,7 +49,7 @@ func (c *coinbaseManager) isBlockRewardFixed(stagingArea *model.StagingArea, blo
|
||||
blueWorkDifference := new(big.Int).Sub(highPruningPointHeader.BlueWork(), lowPruningPointHeader.BlueWork())
|
||||
blueScoreDifference := new(big.Int).SetUint64(highPruningPointHeader.BlueScore() - lowPruningPointHeader.BlueScore())
|
||||
estimatedAverageHashRate := new(big.Int).Div(blueWorkDifference, blueScoreDifference)
|
||||
if estimatedAverageHashRate.Cmp(c.fixedSubsidySwitchHashRateDifference) >= 0 {
|
||||
if estimatedAverageHashRate.Cmp(c.fixedSubsidySwitchHashRateThreshold) >= 0 {
|
||||
return true, nil
|
||||
}
|
||||
|
||||
|
@ -32,7 +32,7 @@ func TestBlockRewardSwitch(t *testing.T) {
|
||||
// Set the hash rate difference such that the switch would trigger exactly
|
||||
// on the `FixedSubsidySwitchPruningPointInterval + 1`th pruning point
|
||||
workToAcceptGenesis := difficulty.CalcWork(consensusConfig.GenesisBlock.Header.Bits())
|
||||
consensusConfig.FixedSubsidySwitchHashRateDifference = workToAcceptGenesis
|
||||
consensusConfig.FixedSubsidySwitchHashRateThreshold = workToAcceptGenesis
|
||||
|
||||
// Set the min, max, and post-switch subsidies to values that would make it
|
||||
// easy to tell whether the switch happened
|
||||
|
@ -22,7 +22,7 @@ type coinbaseManager struct {
|
||||
coinbasePayloadScriptPublicKeyMaxLength uint8
|
||||
genesisHash *externalapi.DomainHash
|
||||
fixedSubsidySwitchPruningPointInterval uint64
|
||||
fixedSubsidySwitchHashRateDifference *big.Int
|
||||
fixedSubsidySwitchHashRateThreshold *big.Int
|
||||
|
||||
databaseContext model.DBReader
|
||||
dagTraversalManager model.DAGTraversalManager
|
||||
@ -364,7 +364,7 @@ func New(
|
||||
coinbasePayloadScriptPublicKeyMaxLength uint8,
|
||||
genesisHash *externalapi.DomainHash,
|
||||
fixedSubsidySwitchPruningPointInterval uint64,
|
||||
fixedSubsidySwitchHashRateDifference *big.Int,
|
||||
fixedSubsidySwitchHashRateThreshold *big.Int,
|
||||
|
||||
dagTraversalManager model.DAGTraversalManager,
|
||||
ghostdagDataStore model.GHOSTDAGDataStore,
|
||||
@ -385,7 +385,7 @@ func New(
|
||||
coinbasePayloadScriptPublicKeyMaxLength: coinbasePayloadScriptPublicKeyMaxLength,
|
||||
genesisHash: genesisHash,
|
||||
fixedSubsidySwitchPruningPointInterval: fixedSubsidySwitchPruningPointInterval,
|
||||
fixedSubsidySwitchHashRateDifference: fixedSubsidySwitchHashRateDifference,
|
||||
fixedSubsidySwitchHashRateThreshold: fixedSubsidySwitchHashRateThreshold,
|
||||
|
||||
dagTraversalManager: dagTraversalManager,
|
||||
ghostdagDataStore: ghostdagDataStore,
|
||||
|
@ -185,7 +185,7 @@ type Params struct {
|
||||
|
||||
FixedSubsidySwitchPruningPointInterval uint64
|
||||
|
||||
FixedSubsidySwitchHashRateDifference *big.Int
|
||||
FixedSubsidySwitchHashRateThreshold *big.Int
|
||||
}
|
||||
|
||||
// NormalizeRPCServerAddress returns addr with the current network default
|
||||
@ -262,7 +262,7 @@ var MainnetParams = Params{
|
||||
CoinbasePayloadScriptPublicKeyMaxLength: defaultCoinbasePayloadScriptPublicKeyMaxLength,
|
||||
PruningProofM: defaultPruningProofM,
|
||||
FixedSubsidySwitchPruningPointInterval: defaultFixedSubsidySwitchPruningPointInterval,
|
||||
FixedSubsidySwitchHashRateDifference: big.NewInt(1_000_000),
|
||||
FixedSubsidySwitchHashRateThreshold: big.NewInt(150_000_000_000),
|
||||
}
|
||||
|
||||
// TestnetParams defines the network parameters for the test Kaspa network.
|
||||
@ -324,7 +324,7 @@ var TestnetParams = Params{
|
||||
CoinbasePayloadScriptPublicKeyMaxLength: defaultCoinbasePayloadScriptPublicKeyMaxLength,
|
||||
PruningProofM: defaultPruningProofM,
|
||||
FixedSubsidySwitchPruningPointInterval: defaultFixedSubsidySwitchPruningPointInterval,
|
||||
FixedSubsidySwitchHashRateDifference: big.NewInt(1_000_000),
|
||||
FixedSubsidySwitchHashRateThreshold: big.NewInt(150_000_000_000),
|
||||
}
|
||||
|
||||
// SimnetParams defines the network parameters for the simulation test Kaspa
|
||||
@ -390,7 +390,7 @@ var SimnetParams = Params{
|
||||
CoinbasePayloadScriptPublicKeyMaxLength: defaultCoinbasePayloadScriptPublicKeyMaxLength,
|
||||
PruningProofM: defaultPruningProofM,
|
||||
FixedSubsidySwitchPruningPointInterval: defaultFixedSubsidySwitchPruningPointInterval,
|
||||
FixedSubsidySwitchHashRateDifference: big.NewInt(1_000_000),
|
||||
FixedSubsidySwitchHashRateThreshold: big.NewInt(150_000_000_000),
|
||||
}
|
||||
|
||||
// DevnetParams defines the network parameters for the development Kaspa network.
|
||||
@ -452,7 +452,7 @@ var DevnetParams = Params{
|
||||
CoinbasePayloadScriptPublicKeyMaxLength: defaultCoinbasePayloadScriptPublicKeyMaxLength,
|
||||
PruningProofM: defaultPruningProofM,
|
||||
FixedSubsidySwitchPruningPointInterval: defaultFixedSubsidySwitchPruningPointInterval,
|
||||
FixedSubsidySwitchHashRateDifference: big.NewInt(1_000_000),
|
||||
FixedSubsidySwitchHashRateThreshold: big.NewInt(150_000_000_000),
|
||||
}
|
||||
|
||||
var (
|
||||
|
Loading…
x
Reference in New Issue
Block a user