Skip to content

Commit

Permalink
Monacoin: Fix build errors.
Browse files Browse the repository at this point in the history
Resolves inconsistencies by moving to the branch to Bitcoin-core.
  • Loading branch information
cryptcoin-junkey committed Feb 20, 2021
1 parent f2a6201 commit b693b99
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 36 deletions.
22 changes: 0 additions & 22 deletions src/chainparams.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,16 +82,6 @@ class CMainParams : public CChainParams {
consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].nStartTime = 1199145601; // January 1, 2008
consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].nTimeout = 1230767999; // December 31, 2008

// Deployment of BIP68, BIP112, and BIP113.
consensus.vDeployments[Consensus::DEPLOYMENT_CSV].bit = 0;
consensus.vDeployments[Consensus::DEPLOYMENT_CSV].nStartTime = 1488931200; // March 8, 2017
consensus.vDeployments[Consensus::DEPLOYMENT_CSV].nTimeout = 1520467200; // March 8, 2018

// Deployment of SegWit (BIP141, BIP143, and BIP147)
consensus.vDeployments[Consensus::DEPLOYMENT_SEGWIT].bit = 1;
consensus.vDeployments[Consensus::DEPLOYMENT_SEGWIT].nStartTime = 1488931200; // March 8, 2017
consensus.vDeployments[Consensus::DEPLOYMENT_SEGWIT].nTimeout = 1520467200; // March 8, 2018

// The best chain should have at least this much work.
consensus.nMinimumChainWork = uint256S("0x00000000000000000000000000000000000000000000001027706bee55d78e52");

Expand Down Expand Up @@ -195,19 +185,7 @@ class CTestNetParams : public CChainParams {
consensus.fPowNoRetargeting = false;
consensus.nRuleChangeActivationThreshold = 75; // 75% for testchains
consensus.nMinerConfirmationWindow = 100; // nPowTargetTimespan / nPowTargetSpacing
consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].bit = 28;
consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].nStartTime = 1199145601; // January 1, 2008
consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].nTimeout = 1230767999; // December 31, 2008

// Deployment of BIP68, BIP112, and BIP113.
consensus.vDeployments[Consensus::DEPLOYMENT_CSV].bit = 0;
consensus.vDeployments[Consensus::DEPLOYMENT_CSV].nStartTime = 1488931200; // March 8, 2017
consensus.vDeployments[Consensus::DEPLOYMENT_CSV].nTimeout = 1520467200; // March 8, 2018

// Deployment of SegWit (BIP141, BIP143, and BIP147)
consensus.vDeployments[Consensus::DEPLOYMENT_SEGWIT].bit = 1;
consensus.vDeployments[Consensus::DEPLOYMENT_SEGWIT].nStartTime = 1488931200; // March 1, 2017
consensus.vDeployments[Consensus::DEPLOYMENT_SEGWIT].nTimeout = 1520467200; // March 8, 2018
// The best chain should have at least this much work.
consensus.nMinimumChainWork = uint256S("0x0000000000000000000000000000000000000000000000000000535d5fc3c9d2");

Expand Down
4 changes: 2 additions & 2 deletions src/key_io.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,12 @@ CTxDestination DecodeDestination(const std::string& str, const CChainParams& par
std::copy(data.begin() + script_prefix.size(), data.end(), hash.begin());
return ScriptHash(hash);
}
// Script-hash-addresses have version 5 for M prefix (or 196 testnet).
// Script-hash-addresses have version 55 for P prefix (or 117 testnet).
// The data vector contains RIPEMD160(SHA256(cscript)), where cscript is the serialized redemption script.
const std::vector<unsigned char>& script_prefix2 = params.Base58Prefix(CChainParams::SCRIPT_ADDRESS2);
if (data.size() == hash.size() + script_prefix2.size() && std::equal(script_prefix2.begin(), script_prefix2.end(), data.begin())) {
std::copy(data.begin() + script_prefix2.size(), data.end(), hash.begin());
return CScriptID(hash);
return ScriptHash(hash);
}
}
data.clear();
Expand Down
19 changes: 7 additions & 12 deletions src/validation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1146,7 +1146,7 @@ static bool WriteBlockToDisk(const CBlock& block, FlatFilePos& pos, const CMessa
return true;
}

bool ReadBlockFromDisk(CBlock& block, const FlatFilePos& pos, const Consensus::Params& consensusParams)
bool ReadBlockFromDisk(CBlock& block, const FlatFilePos& pos, int nHeight, const Consensus::Params& consensusParams)
{
block.SetNull();

Expand Down Expand Up @@ -1856,13 +1856,8 @@ static unsigned int GetBlockScriptFlags(const CBlockIndex* pindex, const Consens
flags |= SCRIPT_VERIFY_CHECKSEQUENCEVERIFY;
}

// Start enforcing WITNESS rules using versionbits logic.
// Start enforcing BIP147 NULLDUMMY (activated simultaneously with segwit)
if (IsWitnessEnabled(pindex->pprev, consensusparams)) {
flags |= SCRIPT_VERIFY_WITNESS;
}

// Start enforcing NULLDUMMY rules using versionbits logic.
if (IsNullDummyEnabled(pindex->pprev, consensusparams)) {
flags |= SCRIPT_VERIFY_NULLDUMMY;
}

Expand Down Expand Up @@ -2031,7 +2026,7 @@ bool CChainState::ConnectBlock(const CBlock& block, CValidationState& state, CBl
// edge case when manipulating the UTXO and it would be simpler not to have
// another edge case to deal with.

// testnet3 has no blocks before the BIP34 height with indicated heights
// testnet4 has no blocks before the BIP34 height with indicated heights
// post BIP34 before approximately height 486,000,000 and presumably will
// be reset before it reaches block 1,983,702 and starts doing unnecessary
// BIP30 checking again.
Expand Down Expand Up @@ -3243,8 +3238,8 @@ static bool CheckBlockHeader(const CBlockHeader& block, CValidationState& state,
// Get prev block index
CBlockIndex* pindexPrev = NULL;
int nHeight = 0;
BlockMap::iterator mi = mapBlockIndex.find(block.hashPrevBlock);
if (mi != mapBlockIndex.end()) {
BlockMap::iterator mi = ::BlockIndex().find(block.hashPrevBlock);
if (mi != ::BlockIndex().end()) {
pindexPrev = (*mi).second;
nHeight = pindexPrev->nHeight + 1;
}
Expand Down Expand Up @@ -3462,7 +3457,7 @@ static bool ContextualCheckBlockHeader(const CBlockHeader& block, CValidationSta
strprintf("rejected nVersion=0x%08x block", block.nVersion));

if (block.nVersion < VERSIONBITS_TOP_BITS && IsWitnessEnabled(pindexPrev, consensusParams))
return state.Invalid(false, REJECT_OBSOLETE, strprintf("bad-version(0x%08x)", block.nVersion),
return state.Invalid(ValidationInvalidReason::BLOCK_INVALID_HEADER, false, REJECT_OBSOLETE, strprintf("bad-version(0x%08x)", block.nVersion),
strprintf("rejected nVersion=0x%08x block", block.nVersion));

return true;
Expand Down Expand Up @@ -4705,7 +4700,7 @@ bool LoadExternalBlockFile(const CChainParams& chainparams, FILE* fileIn, FlatFi
std::multimap<uint256, FlatFilePos>::iterator it = range.first;
std::shared_ptr<CBlock> pblockrecursive = std::make_shared<CBlock>();
uint256 hash = block.GetHash();
int nHeight = mapBlockIndex[hash]->nHeight;
int nHeight = ::BlockIndex()[hash]->nHeight;
if (ReadBlockFromDisk(*pblockrecursive, it->second, nHeight, chainparams.GetConsensus()))
{
LogPrint(BCLog::REINDEX, "%s: Processing out of order child %s of %s\n", __func__, pblockrecursive->GetHash().ToString(),
Expand Down

0 comments on commit b693b99

Please sign in to comment.