mirror of
https://github.com/dashpay/dash.git
synced 2024-12-26 20:42:59 +01:00
disable block cache / fix reprocess
This commit is contained in:
parent
8b62e590df
commit
44c99417d2
20
src/main.cpp
20
src/main.cpp
@ -3106,15 +3106,17 @@ bool AcceptBlockHeader(const CBlockHeader& block, CValidationState& state, CBloc
|
||||
uint256 hash = block.GetHash();
|
||||
BlockMap::iterator miSelf = mapBlockIndex.find(hash);
|
||||
CBlockIndex *pindex = NULL;
|
||||
if (miSelf != mapBlockIndex.end()) {
|
||||
// Block header is already known.
|
||||
pindex = miSelf->second;
|
||||
if (ppindex)
|
||||
*ppindex = pindex;
|
||||
if (pindex->nStatus & BLOCK_FAILED_MASK)
|
||||
return state.Invalid(error("%s : block is marked invalid", __func__), 0, "duplicate");
|
||||
return true;
|
||||
}
|
||||
|
||||
// TODO : ENABLE BLOCK CACHE IN SPECIFIC CASES
|
||||
// if (miSelf != mapBlockIndex.end()) {
|
||||
// // Block header is already known.
|
||||
// pindex = miSelf->second;
|
||||
// if (ppindex)
|
||||
// *ppindex = pindex;
|
||||
// if (pindex->nStatus & BLOCK_FAILED_MASK)
|
||||
// return state.Invalid(error("%s : block is marked invalid", __func__), 0, "duplicate");
|
||||
// return true;
|
||||
// }
|
||||
|
||||
if (!CheckBlockHeader(block, state))
|
||||
return false;
|
||||
|
@ -209,6 +209,8 @@ std::string GetWarnings(std::string strFor);
|
||||
bool GetTransaction(const uint256 &hash, CTransaction &tx, uint256 &hashBlock, bool fAllowSlow = false);
|
||||
/** Find the best known block, and make it the tip of the block chain */
|
||||
|
||||
bool DisconnectBlocksAndReprocess(int blocks);
|
||||
|
||||
// ***TODO***
|
||||
double ConvertBitsToDouble(unsigned int nBits);
|
||||
int64_t GetMasternodePayment(int nHeight, int64_t blockValue);
|
||||
|
@ -134,27 +134,16 @@ void ExecuteSpork(int nSporkID, int nValue)
|
||||
//correct fork via spork technology
|
||||
if(nSporkID == SPORK_12_RECONSIDER_BLOCKS && nValue > 0) {
|
||||
LogPrintf("Spork::ExecuteSpork -- Reconcider Last %d Blocks\n", nValue);
|
||||
CBlockIndex* pindexPrev = chainActive.Tip();
|
||||
int count = 0;
|
||||
|
||||
for (unsigned int i = 1; pindexPrev && pindexPrev->nHeight > 0; i++) {
|
||||
count++;
|
||||
if(count >= nValue) return;
|
||||
CValidationState state;
|
||||
{
|
||||
LOCK(cs_main);
|
||||
|
||||
CValidationState state;
|
||||
{
|
||||
LOCK(cs_main);
|
||||
DisconnectBlocksAndReprocess(nValue);
|
||||
}
|
||||
|
||||
LogPrintf("Spork::ExecuteSpork -- Reconcider %s\n", pindexPrev->phashBlock->ToString());
|
||||
ReconsiderBlock(state, pindexPrev);
|
||||
}
|
||||
|
||||
if (state.IsValid()) {
|
||||
ActivateBestChain(state);
|
||||
}
|
||||
|
||||
if (pindexPrev->pprev == NULL) { assert(pindexPrev); break; }
|
||||
pindexPrev = pindexPrev->pprev;
|
||||
if (state.IsValid()) {
|
||||
ActivateBestChain(state);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user