mirror of
https://github.com/dashpay/dash.git
synced 2024-12-27 13:03:17 +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();
|
uint256 hash = block.GetHash();
|
||||||
BlockMap::iterator miSelf = mapBlockIndex.find(hash);
|
BlockMap::iterator miSelf = mapBlockIndex.find(hash);
|
||||||
CBlockIndex *pindex = NULL;
|
CBlockIndex *pindex = NULL;
|
||||||
if (miSelf != mapBlockIndex.end()) {
|
|
||||||
// Block header is already known.
|
// TODO : ENABLE BLOCK CACHE IN SPECIFIC CASES
|
||||||
pindex = miSelf->second;
|
// if (miSelf != mapBlockIndex.end()) {
|
||||||
if (ppindex)
|
// // Block header is already known.
|
||||||
*ppindex = pindex;
|
// pindex = miSelf->second;
|
||||||
if (pindex->nStatus & BLOCK_FAILED_MASK)
|
// if (ppindex)
|
||||||
return state.Invalid(error("%s : block is marked invalid", __func__), 0, "duplicate");
|
// *ppindex = pindex;
|
||||||
return true;
|
// if (pindex->nStatus & BLOCK_FAILED_MASK)
|
||||||
}
|
// return state.Invalid(error("%s : block is marked invalid", __func__), 0, "duplicate");
|
||||||
|
// return true;
|
||||||
|
// }
|
||||||
|
|
||||||
if (!CheckBlockHeader(block, state))
|
if (!CheckBlockHeader(block, state))
|
||||||
return false;
|
return false;
|
||||||
|
@ -209,6 +209,8 @@ std::string GetWarnings(std::string strFor);
|
|||||||
bool GetTransaction(const uint256 &hash, CTransaction &tx, uint256 &hashBlock, bool fAllowSlow = false);
|
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 */
|
/** Find the best known block, and make it the tip of the block chain */
|
||||||
|
|
||||||
|
bool DisconnectBlocksAndReprocess(int blocks);
|
||||||
|
|
||||||
// ***TODO***
|
// ***TODO***
|
||||||
double ConvertBitsToDouble(unsigned int nBits);
|
double ConvertBitsToDouble(unsigned int nBits);
|
||||||
int64_t GetMasternodePayment(int nHeight, int64_t blockValue);
|
int64_t GetMasternodePayment(int nHeight, int64_t blockValue);
|
||||||
|
@ -134,28 +134,17 @@ void ExecuteSpork(int nSporkID, int nValue)
|
|||||||
//correct fork via spork technology
|
//correct fork via spork technology
|
||||||
if(nSporkID == SPORK_12_RECONSIDER_BLOCKS && nValue > 0) {
|
if(nSporkID == SPORK_12_RECONSIDER_BLOCKS && nValue > 0) {
|
||||||
LogPrintf("Spork::ExecuteSpork -- Reconcider Last %d Blocks\n", nValue);
|
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;
|
CValidationState state;
|
||||||
{
|
{
|
||||||
LOCK(cs_main);
|
LOCK(cs_main);
|
||||||
|
|
||||||
LogPrintf("Spork::ExecuteSpork -- Reconcider %s\n", pindexPrev->phashBlock->ToString());
|
DisconnectBlocksAndReprocess(nValue);
|
||||||
ReconsiderBlock(state, pindexPrev);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (state.IsValid()) {
|
if (state.IsValid()) {
|
||||||
ActivateBestChain(state);
|
ActivateBestChain(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pindexPrev->pprev == NULL) { assert(pindexPrev); break; }
|
|
||||||
pindexPrev = pindexPrev->pprev;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user