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.TimestampDeviationTolerance,
config.TargetTimePerBlock,
config.IgnoreHeaderMass,
dbManager,
difficultyManager,

View File

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

View File

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

View File

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