-
Notifications
You must be signed in to change notification settings - Fork 725
[Refactor] ChainParams::consensus - Part 2 #1344
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Refactor] ChainParams::consensus - Part 2 #1344
Conversation
64465b7 [Refactor] Consensus: Stake Modifier V2 (random-zebra) 8083725 [Refactor] Consensus: TimeProtocolV2 parameters (random-zebra) 4d1c696 [Refactor] Consensus: nStakeMinAge, nStakeMinDepth, nFutureTimeDrift (random-zebra) e69cee2 [Refactor] Consensus: restore nMaxMoneyOut as consensus param (random-zebra) 08a581d [Refactor] Consensus: fAllowMinDifficultyBlocks, fPowNoRetargeting (random-zebra) ca6ea3c [Refactor] Consensus: nTargetTimespan, nTargetSpacing, nTimeSlotLength (random-zebra) a281dee [Refactor] Consensus: remove unneeded getters. Rename BIP65Height (random-zebra) 284271c [Refactor] Consensus: bnProofOfWorkLimit / bnProofOfStakeLimit (v1-v2) (random-zebra) Pull request description: This PR builds on - [x] #1328 Populates the `consensus` struct with all relevant consensus parameters. Resets `nMaxMoneyOut` as chain param (with different value for TestNet). Cleans up several unneeded fields in ChainParams. EDIT: Current PR has been split in two. Second part is #1344 ACKs for top commit: furszy: good, utACK 64465b7. Fuzzbawls: utACK 64465b7 Tree-SHA512: d3e46bc8bb2ad9ee48abcbc4d4b1df2f59914360aaca72e93e19a5578248ecb95fd6a422477238e4736bc767d4e226f5b7f867174d96dcace73621946bf84df8
fddc127 to
b10358b
Compare
|
Rebased after merge of #1341 |
b10358b to
5d6f5ae
Compare
|
Rebased after merge of #1338 |
- nZerocoinStartHeight - nBlockZerocoinV2 - nBlockEnforceSerialRange - nBlockRecalculateAccumulators - nBlockFirstFraudulent - nBlockLastGoodCheckpoint (removed) - nModifierUpdateBlock - nFakeSerialBlockheightEnd - nBlockEnforceInvalidUTXO - nBlockDoubleAccumulated (removed) - nPublicZCSpends - nBlockEnforceNewMessageSignatures - nBlockV7StartHeight (removed) - nBlockLastAccumulatorCheckpoint
5d6f5ae to
fe13fe5
Compare
|
Rebased after merging #1342 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Commit e253c7f2491316708e41cf944a3fb2c48386a9f4 results in testnet halting sync at block 201 due to the invalid nBits (referenced in #915). The changes here only take mainnet into consideration so need to add the testnet values back.
Suggested patch:
Index: src/chainparams.cpp
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- src/chainparams.cpp (revision 4d721223520870d03e44cd1df256f4fe76daa700)
+++ src/chainparams.cpp (date 1582681779760)
@@ -197,8 +197,8 @@
consensus.height_ZC_RecalcAccumulators = 908000;
// validation by-pass
- consensus.blk_259201_nTime = 1471401614; // Skip nBit validation of Block 259201 per PR #915
- consensus.blk_259201_nBits = 0x1c056dac; // Skip nBit validation of Block 259201 per PR #915
+ consensus.nPivxBadBlockTime = 1471401614; // Skip nBit validation of Block 259201 per PR #915
+ consensus.nPivxBadBlockBits = 0x1c056dac; // Skip nBit validation of Block 259201 per PR #915
// Zerocoin-related params
consensus.ZC_Modulus = "25195908475657893494027183240048398571429282126204032027777137836043662020707595556264018525880784"
@@ -319,6 +319,10 @@
consensus.height_start_ZC_SerialsV2 = 444020;
consensus.height_ZC_RecalcAccumulators = 999999999;
+ // validation by-pass
+ consensus.nPivxBadBlockTime = 1489001494; // Skip nBit validation of Block 201 per PR #915
+ consensus.nPivxBadBlockBits = 0x1e0a20bd; // Skip nBit validation of Block 201 per PR #915
+
// Zerocoin-related params
consensus.ZC_Modulus = "25195908475657893494027183240048398571429282126204032027777137836043662020707595556264018525880784"
"4069182906412495150821892985591491761845028084891200728449926873928072877767359714183472702618963750149718246911"
Index: src/consensus/params.h
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- src/consensus/params.h (revision 4d721223520870d03e44cd1df256f4fe76daa700)
+++ src/consensus/params.h (date 1582681711334)
@@ -69,8 +69,8 @@
int height_ZC_RecalcAccumulators;
// validation by-pass
- int64_t blk_259201_nTime;
- unsigned int blk_259201_nBits;
+ int64_t nPivxBadBlockTime;
+ unsigned int nPivxBadBlockBits;
int64_t TargetTimespan(const bool fV2 = true) const { return fV2 ? nTargetTimespanV2 : nTargetTimespan; }
Index: src/main.cpp
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- src/main.cpp (revision 4d721223520870d03e44cd1df256f4fe76daa700)
+++ src/main.cpp (date 1582681711329)
@@ -3854,8 +3854,8 @@
if (block.nBits != nBitsRequired) {
// Pivx Specific reference to the block with the wrong threshold was used.
const Consensus::Params& consensus = Params().GetConsensus();
- if ((block.nTime == (uint32_t) consensus.blk_259201_nTime) &&
- (block.nBits == (uint32_t) consensus.blk_259201_nTime)) {
+ if ((block.nTime == (uint32_t) consensus.nPivxBadBlockTime) &&
+ (block.nBits == (uint32_t) consensus.nPivxBadBlockBits)) {
// accept PIVX block minted with incorrect proof of work threshold
return true;
}fe13fe5 to
ac5ed53
Compare
|
@Fuzzbawls good catch. Fixed in 98494ab |
- zerocoinModulus - nMaxZerocoinSpendsPerTransaction - nMaxZerocoinPublicSpendsPerTransaction - nMinZerocoinMintFee - nMintRequiredConfirmations - nRequiredAccumulation (removed) - nDefaultSecurityLevel (removed) - nZerocoinHeaderVersion (removed) - nZerocoinRequiredStakeDepth - nZerocoinStartTime
- nMasternodeCountDrift - nBudgetCycleBlocks - nProposalEstablishmentTime - nBudget_Fee_Confirmations - nStartMasternodePayments (removed) - strObfuscationPoolDummyAddress - nPoolMaxTransactions + spork keys handling
- nPivxBadBlockTime / nPivxBadBlocknBits - nInvalidAmountFiltered (moved outside chain params) - nMinColdStakingAmount (moved outside chain params) - fHeadersFirstSyncingActive (removed) - fTestnetToBeDeprecatedFieldRPC (removed) - fSkipProofOfWorkCheck (removed - use IsRegTestNet) - fRequireStandard (removed - use IsRegTestNet) - fDefaultConsistencyChecks (removed - use IsRegTestNet) - fMiningRequiresPeers (removed - use IsRegTestNet) - nMaxReorganizationDepth (moved outside chain params) - nEnforce[/nReject/nToCheck]BlockUpgradeMajority
ac5ed53 to
92221b1
Compare
Fuzzbawls
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK 92221b1
furszy
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Second part of
Split as individual PR for ease of review.