Merge #11012: Make sure to clean up mapBlockSource if we've already seen the block
3f8fa7f Make sure to clean up mapBlockSource if we've already seen the block (Cory Fields) Pull request description: Otherwise we may leave them dangling. Credit TheBlueMatt. Tree-SHA512: 8be77e08ebfc4f5b206d5ee7cfbe87f92c1eb5bc2b412471993658fe210306789aaf0f3d1454c635508a7d8effede2cf5ac144d622b0157b872733d9661d65c3
This commit is contained in:
parent
19a17a58d2
commit
ac80c90123
@ -2450,9 +2450,12 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr
|
||||
}
|
||||
bool fNewBlock = false;
|
||||
ProcessNewBlock(chainparams, pblock, true, &fNewBlock);
|
||||
if (fNewBlock)
|
||||
if (fNewBlock) {
|
||||
pfrom->nLastBlockTime = GetTime();
|
||||
|
||||
} else {
|
||||
LOCK(cs_main);
|
||||
mapBlockSource.erase(pblock->GetHash());
|
||||
}
|
||||
LOCK(cs_main); // hold cs_main for CBlockIndex::IsValid()
|
||||
if (pindex->IsValid(BLOCK_VALID_TRANSACTIONS)) {
|
||||
// Clear download state for this block, which is in
|
||||
@ -2527,8 +2530,12 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr
|
||||
// Since we requested this block (it was in mapBlocksInFlight), force it to be processed,
|
||||
// even if it would not be a candidate for new tip (missing previous block, chain not long enough, etc)
|
||||
ProcessNewBlock(chainparams, pblock, true, &fNewBlock);
|
||||
if (fNewBlock)
|
||||
if (fNewBlock) {
|
||||
pfrom->nLastBlockTime = GetTime();
|
||||
} else {
|
||||
LOCK(cs_main);
|
||||
mapBlockSource.erase(pblock->GetHash());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -2704,8 +2711,12 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr
|
||||
}
|
||||
bool fNewBlock = false;
|
||||
ProcessNewBlock(chainparams, pblock, forceProcessing, &fNewBlock);
|
||||
if (fNewBlock)
|
||||
if (fNewBlock) {
|
||||
pfrom->nLastBlockTime = GetTime();
|
||||
} else {
|
||||
LOCK(cs_main);
|
||||
mapBlockSource.erase(pblock->GetHash());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user