Properly initialize confirmedHash in CSimplifiedMNListEntry (#2479)

* Properly initialize confirmedHash in CSimplifiedMNListEntry

* Add consensus params for temporary hard-fork on testnet

This hard-fork is required on testnet as we have to fix a few consensus
bugs in DIP3/DIP4. It will also be required to introduce LLMQ commitments
to testnet.

* Add temporary fork-logic for testnet, which sets confirmedHash to null

...before fork activation. Otherwise we'd invalidate all DIP3 blocks on
testnet.

* Bump nTemporaryTestnetForkHeight to 273000
This commit is contained in:
Alexander Block 2018-11-23 10:40:46 +01:00 committed by GitHub
parent df7d12b41f
commit d40a5ce31f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 25 additions and 0 deletions

View File

@ -378,6 +378,11 @@ public:
// Testnet Dash BIP44 coin type is '1' (All coin's testnet default)
nExtCoinType = 1;
// This is temporary until we reset testnet for retesting of the full DIP3 deployment
consensus.nTemporaryTestnetForkDIP3Height = 264000;
consensus.nTemporaryTestnetForkHeight = 273000;
consensus.nTemporaryTestnetForkDIP3BlockHash.SetHex("00000048e6e71d4bd90e7c456dcb94683ae832fcad13e1760d8283f7e89f332f");
fMiningRequiresPeers = true;
fDefaultConsistencyChecks = false;
fRequireStandard = false;

View File

@ -95,6 +95,11 @@ struct Params {
int nMinimumDifficultyBlocks{0};
int nHighSubsidyBlocks{0};
int nHighSubsidyFactor{1};
// This is temporary until we reset testnet for retesting of the full DIP3 deployment
int nTemporaryTestnetForkDIP3Height{0};
uint256 nTemporaryTestnetForkDIP3BlockHash;
int nTemporaryTestnetForkHeight{0};
};
} // namespace Consensus

View File

@ -7,6 +7,7 @@
#include "simplifiedmns.h"
#include "specialtx.h"
#include "chainparams.h"
#include "univalue.h"
#include "validation.h"
@ -71,6 +72,19 @@ bool CalcCbTxMerkleRootMNList(const CBlock& block, const CBlockIndex* pindexPrev
}
CSimplifiedMNList sml(tmpMNList);
// BEGIN TEMPORARY CODE
const auto& consensus = Params().GetConsensus();
if (consensus.nTemporaryTestnetForkHeight != 0 &&
pindexPrev->nHeight + 1 >= consensus.nTemporaryTestnetForkDIP3Height &&
pindexPrev->nHeight + 1 < consensus.nTemporaryTestnetForkHeight &&
chainActive[consensus.nTemporaryTestnetForkDIP3Height]->GetBlockHash() == consensus.nTemporaryTestnetForkDIP3BlockHash) {
for (auto& sme : sml.mnList) {
sme.confirmedHash.SetNull();
}
}
// END TEMPORARY CODE
bool mutated = false;
merkleRootRet = sml.CalcMerkleRoot(&mutated);
return !mutated;

View File

@ -15,6 +15,7 @@
CSimplifiedMNListEntry::CSimplifiedMNListEntry(const CDeterministicMN& dmn) :
proRegTxHash(dmn.proTxHash),
confirmedHash(dmn.pdmnState->confirmedHash),
service(dmn.pdmnState->addr),
pubKeyOperator(dmn.pdmnState->pubKeyOperator),
keyIDVoting(dmn.pdmnState->keyIDVoting),