Skip to content

Commit

Permalink
Add block 50000 to the checkpoints (#36)
Browse files Browse the repository at this point in the history
* Bump min protocol version to 70213

* Add block 50,000 to the checkpoints

* Reject bad chain with wrong rewards, block 50000

* Formating

* Update invalidate logic, all blocks which are different than the main chain will be invalidated.
  • Loading branch information
alejandromgk committed Apr 22, 2018
1 parent 527c443 commit 38662a0
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/chainparams.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,10 +164,10 @@ class CMainParams : public CChainParams {
consensus.vDeployments[Consensus::DEPLOYMENT_DIP0001].nThreshold = 3226; // 80% of 4032

// The best chain should have at least this much work.
consensus.nMinimumChainWork = uint256S("0x0000000000000000000000000000000000000000000000203f8f83ae7bdcfdb6"); // #50590
consensus.nMinimumChainWork = uint256S("0x0000000000000000000000000000000000000000000000204045f68ab84052de"); // #50620

// By default assume that the signatures in ancestors of this block are valid.
consensus.defaultAssumeValid = uint256S("0x0000000000002b2ce7aecd2367b13eb050e35aabbbaf5ce94568e8d684f4c6b4"); // #50590
consensus.defaultAssumeValid = uint256S("0x0000000000000349685ff23a2344db4d51ae9f169cda23c8a472fb783914b071"); // #50620

/**
* The message start string is designed to be unlikely to occur in normal data.
Expand Down Expand Up @@ -227,9 +227,10 @@ class CMainParams : public CChainParams {
( 100, uint256S("0x000005065df82218140bc7c59cfd6913eaa5a88f3255ccc977c546cb0beb9ff0"))
( 7200, uint256S("0x00000000000b7d73439cae777bae147b8daaee692a9e5e06fd8466749de39465"))
( 43850, uint256S("0x0000000000000be675f137fbf5cbe5e9d8cb0ea509d30252a02c30944f16970f"))
( 50590, uint256S("0x0000000000002b2ce7aecd2367b13eb050e35aabbbaf5ce94568e8d684f4c6b4")),
1524410366, // * UNIX timestamp of last checkpoint block
167138, // * total number of transactions between genesis and last checkpoint
( 50000, uint256S("0x00000000000007cdd43a784898eb9cb5be63ca7db5e5935a05a1baa01a658ca0"))
( 50620, uint256S("0x0000000000000349685ff23a2344db4d51ae9f169cda23c8a472fb783914b071")),
1524414644, // * UNIX timestamp of last checkpoint block
167228, // * total number of transactions between genesis and last checkpoint
// (the tx=... number in the SetBestChain debug.log lines)
1500 // * estimated number of transactions per day after checkpoint
};
Expand Down
8 changes: 8 additions & 0 deletions src/validation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2230,6 +2230,14 @@ static bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockInd
// the peer who sent us this block is missing some data and wasn't able
// to recognize that block is actually invalid.
// TODO: resync data (both ways?) and try to reprocess this block later.
int nInvalidMasternodePaymentsIncreaseBlock = chainparams.GetConsensus().nMasternodePaymentsIncreaseBlock;
if (chainparams.NetworkIDString() == CBaseChainParams::MAIN &&
pindex->nHeight == nInvalidMasternodePaymentsIncreaseBlock &&
pindex->GetBlockHash() != uint256S("0x00000000000007cdd43a784898eb9cb5be63ca7db5e5935a05a1baa01a658ca0")) {
InvalidateBlock(state, chainparams.GetConsensus(), pindex);
return state.DoS(0, error("ConnectBlock(PAC): invalid chain found on block %i", nInvalidMasternodePaymentsIncreaseBlock), REJECT_INVALID, "bad-chain-found");
}

CAmount blockReward = nFees + GetBlockSubsidy(pindex->pprev->nBits, pindex->pprev->nHeight, chainparams.GetConsensus());
std::string strError = "";
if (!IsBlockValueValid(block, pindex->nHeight, blockReward, strError)) {
Expand Down

0 comments on commit 38662a0

Please sign in to comment.