Ignore header mass in devnet and testnet (#1879)

This commit is contained in:
Ori Newman 2021-12-11 20:36:58 +02:00 committed by GitHub
parent df573bba63
commit f3d76d6565
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 13 additions and 3 deletions

View File

@ -307,6 +307,7 @@ func (f *factory) NewConsensus(config *Config, db infrastructuredatabase.Databas
config.MaxBlockParents, config.MaxBlockParents,
config.TimestampDeviationTolerance, config.TimestampDeviationTolerance,
config.TargetTimePerBlock, config.TargetTimePerBlock,
config.IgnoreHeaderMass,
dbManager, dbManager,
difficultyManager, difficultyManager,

View File

@ -220,7 +220,9 @@ func (v *blockValidator) validateGasLimit(block *externalapi.DomainBlock) error
func (v *blockValidator) checkBlockMass(block *externalapi.DomainBlock) error { func (v *blockValidator) checkBlockMass(block *externalapi.DomainBlock) error {
mass := uint64(0) mass := uint64(0)
mass += v.headerEstimatedSerializedSize(block.Header) if !v.ignoreHeaderMass {
mass += v.headerEstimatedSerializedSize(block.Header)
}
for _, transaction := range block.Transactions { for _, transaction := range block.Transactions {
v.transactionValidator.PopulateMass(transaction) v.transactionValidator.PopulateMass(transaction)

View File

@ -22,6 +22,7 @@ type blockValidator struct {
maxBlockParents externalapi.KType maxBlockParents externalapi.KType
timestampDeviationTolerance int timestampDeviationTolerance int
targetTimePerBlock time.Duration targetTimePerBlock time.Duration
ignoreHeaderMass bool
databaseContext model.DBReader databaseContext model.DBReader
difficultyManager model.DifficultyManager difficultyManager model.DifficultyManager
@ -58,6 +59,7 @@ func New(powMax *big.Int,
maxBlockParents externalapi.KType, maxBlockParents externalapi.KType,
timestampDeviationTolerance int, timestampDeviationTolerance int,
targetTimePerBlock time.Duration, targetTimePerBlock time.Duration,
ignoreHeaderMass bool,
databaseContext model.DBReader, databaseContext model.DBReader,
@ -94,6 +96,7 @@ func New(powMax *big.Int,
maxBlockMass: maxBlockMass, maxBlockMass: maxBlockMass,
mergeSetSizeLimit: mergeSetSizeLimit, mergeSetSizeLimit: mergeSetSizeLimit,
maxBlockParents: maxBlockParents, maxBlockParents: maxBlockParents,
ignoreHeaderMass: ignoreHeaderMass,
timestampDeviationTolerance: timestampDeviationTolerance, timestampDeviationTolerance: timestampDeviationTolerance,
targetTimePerBlock: targetTimePerBlock, targetTimePerBlock: targetTimePerBlock,

View File

@ -188,6 +188,8 @@ type Params struct {
FixedSubsidySwitchHashRateThreshold *big.Int FixedSubsidySwitchHashRateThreshold *big.Int
DisallowDirectBlocksOnTopOfGenesis bool DisallowDirectBlocksOnTopOfGenesis bool
IgnoreHeaderMass bool
} }
// NormalizeRPCServerAddress returns addr with the current network default // NormalizeRPCServerAddress returns addr with the current network default
@ -280,11 +282,11 @@ var MainnetParams = Params{
// TestnetParams defines the network parameters for the test Kaspa network. // TestnetParams defines the network parameters for the test Kaspa network.
var TestnetParams = Params{ var TestnetParams = Params{
K: defaultGHOSTDAGK, K: defaultGHOSTDAGK,
Name: "kaspa-testnet-6", Name: "kaspa-testnet-7",
Net: appmessage.Testnet, Net: appmessage.Testnet,
RPCPort: "16210", RPCPort: "16210",
DefaultPort: "16211", DefaultPort: "16211",
DNSSeeds: []string{"testnet-6-dnsseed.daglabs-dev.com"}, DNSSeeds: []string{"testnet-7-dnsseed.daglabs-dev.com"},
// DAG parameters // DAG parameters
GenesisBlock: &testnetGenesisBlock, GenesisBlock: &testnetGenesisBlock,
@ -337,6 +339,7 @@ var TestnetParams = Params{
PruningProofM: defaultPruningProofM, PruningProofM: defaultPruningProofM,
FixedSubsidySwitchPruningPointInterval: defaultFixedSubsidySwitchPruningPointInterval, FixedSubsidySwitchPruningPointInterval: defaultFixedSubsidySwitchPruningPointInterval,
FixedSubsidySwitchHashRateThreshold: big.NewInt(150_000_000_000), FixedSubsidySwitchHashRateThreshold: big.NewInt(150_000_000_000),
IgnoreHeaderMass: true,
} }
// SimnetParams defines the network parameters for the simulation test Kaspa // SimnetParams defines the network parameters for the simulation test Kaspa
@ -465,6 +468,7 @@ var DevnetParams = Params{
PruningProofM: defaultPruningProofM, PruningProofM: defaultPruningProofM,
FixedSubsidySwitchPruningPointInterval: defaultFixedSubsidySwitchPruningPointInterval, FixedSubsidySwitchPruningPointInterval: defaultFixedSubsidySwitchPruningPointInterval,
FixedSubsidySwitchHashRateThreshold: big.NewInt(150_000_000_000), FixedSubsidySwitchHashRateThreshold: big.NewInt(150_000_000_000),
IgnoreHeaderMass: true,
} }
var ( var (