|
|
@ -3013,7 +3013,7 @@ static void NotifyHeaderTip() { |
|
|
|
* or an activated best chain. pblock is either NULL or a pointer to a block |
|
|
|
* or an activated best chain. pblock is either NULL or a pointer to a block |
|
|
|
* that is already loaded (to avoid loading it again from disk). |
|
|
|
* that is already loaded (to avoid loading it again from disk). |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
bool ActivateBestChain(CValidationState &state, const CChainParams& chainparams, const CBlock *pblock, CConnman* connman) { |
|
|
|
bool ActivateBestChain(CValidationState &state, const CChainParams& chainparams, const CBlock *pblock) { |
|
|
|
CBlockIndex *pindexMostWork = NULL; |
|
|
|
CBlockIndex *pindexMostWork = NULL; |
|
|
|
CBlockIndex *pindexNewTip = NULL; |
|
|
|
CBlockIndex *pindexNewTip = NULL; |
|
|
|
std::vector<std::tuple<CTransaction,CBlockIndex*,int>> txChanged; |
|
|
|
std::vector<std::tuple<CTransaction,CBlockIndex*,int>> txChanged; |
|
|
@ -3703,7 +3703,7 @@ static bool AcceptBlock(const CBlock& block, CValidationState& state, const CCha |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
bool ProcessNewBlock(CValidationState& state, const CChainParams& chainparams, CNode* pfrom, const CBlock* pblock, bool fForceProcessing, const CDiskBlockPos* dbp, CConnman* connman) |
|
|
|
bool ProcessNewBlock(CValidationState& state, const CChainParams& chainparams, CNode* pfrom, const CBlock* pblock, bool fForceProcessing, const CDiskBlockPos* dbp) |
|
|
|
{ |
|
|
|
{ |
|
|
|
{ |
|
|
|
{ |
|
|
|
LOCK(cs_main); |
|
|
|
LOCK(cs_main); |
|
|
@ -3725,7 +3725,7 @@ bool ProcessNewBlock(CValidationState& state, const CChainParams& chainparams, C |
|
|
|
|
|
|
|
|
|
|
|
NotifyHeaderTip(); |
|
|
|
NotifyHeaderTip(); |
|
|
|
|
|
|
|
|
|
|
|
if (!ActivateBestChain(state, chainparams, pblock, connman)) |
|
|
|
if (!ActivateBestChain(state, chainparams, pblock)) |
|
|
|
return error("%s: ActivateBestChain failed", __func__); |
|
|
|
return error("%s: ActivateBestChain failed", __func__); |
|
|
|
|
|
|
|
|
|
|
|
return true; |
|
|
|
return true; |
|
|
@ -5764,7 +5764,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv, |
|
|
|
pfrom->PushMessage(NetMsgType::GETDATA, invs); |
|
|
|
pfrom->PushMessage(NetMsgType::GETDATA, invs); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
CValidationState state; |
|
|
|
CValidationState state; |
|
|
|
ProcessNewBlock(state, chainparams, pfrom, &block, false, NULL, &connman); |
|
|
|
ProcessNewBlock(state, chainparams, pfrom, &block, false, NULL); |
|
|
|
int nDoS; |
|
|
|
int nDoS; |
|
|
|
if (state.IsInvalid(nDoS)) { |
|
|
|
if (state.IsInvalid(nDoS)) { |
|
|
|
assert (state.GetRejectCode() < REJECT_INTERNAL); // Blocks are never rejected with internal reject codes
|
|
|
|
assert (state.GetRejectCode() < REJECT_INTERNAL); // Blocks are never rejected with internal reject codes
|
|
|
@ -5940,7 +5940,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv, |
|
|
|
// Such an unrequested block may still be processed, subject to the
|
|
|
|
// Such an unrequested block may still be processed, subject to the
|
|
|
|
// conditions in AcceptBlock().
|
|
|
|
// conditions in AcceptBlock().
|
|
|
|
bool forceProcessing = pfrom->fWhitelisted && !IsInitialBlockDownload(); |
|
|
|
bool forceProcessing = pfrom->fWhitelisted && !IsInitialBlockDownload(); |
|
|
|
ProcessNewBlock(state, chainparams, pfrom, &block, forceProcessing, NULL, &connman); |
|
|
|
ProcessNewBlock(state, chainparams, pfrom, &block, forceProcessing, NULL); |
|
|
|
int nDoS; |
|
|
|
int nDoS; |
|
|
|
if (state.IsInvalid(nDoS)) { |
|
|
|
if (state.IsInvalid(nDoS)) { |
|
|
|
assert (state.GetRejectCode() < REJECT_INTERNAL); // Blocks are never rejected with internal reject codes
|
|
|
|
assert (state.GetRejectCode() < REJECT_INTERNAL); // Blocks are never rejected with internal reject codes
|
|
|
|