@@ -2134,9 +2134,12 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr
2134
2134
}
2135
2135
bool fNewBlock = false ;
2136
2136
ProcessNewBlock (chainparams, pblock, true , &fNewBlock );
2137
- if (fNewBlock )
2137
+ if (fNewBlock ) {
2138
2138
pfrom->nLastBlockTime = GetTime ();
2139
-
2139
+ } else {
2140
+ LOCK (cs_main);
2141
+ mapBlockSource.erase (pblock->GetHash ());
2142
+ }
2140
2143
LOCK (cs_main); // hold cs_main for CBlockIndex::IsValid()
2141
2144
if (pindex->IsValid (BLOCK_VALID_TRANSACTIONS)) {
2142
2145
// Clear download state for this block, which is in
@@ -2211,8 +2214,12 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr
2211
2214
// Since we requested this block (it was in mapBlocksInFlight), force it to be processed,
2212
2215
// even if it would not be a candidate for new tip (missing previous block, chain not long enough, etc)
2213
2216
ProcessNewBlock (chainparams, pblock, true , &fNewBlock );
2214
- if (fNewBlock )
2217
+ if (fNewBlock ) {
2215
2218
pfrom->nLastBlockTime = GetTime ();
2219
+ } else {
2220
+ LOCK (cs_main);
2221
+ mapBlockSource.erase (pblock->GetHash ());
2222
+ }
2216
2223
}
2217
2224
}
2218
2225
@@ -2390,8 +2397,12 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr
2390
2397
}
2391
2398
bool fNewBlock = false ;
2392
2399
ProcessNewBlock (chainparams, pblock, forceProcessing, &fNewBlock );
2393
- if (fNewBlock )
2400
+ if (fNewBlock ) {
2394
2401
pfrom->nLastBlockTime = GetTime ();
2402
+ } else {
2403
+ LOCK (cs_main);
2404
+ mapBlockSource.erase (pblock->GetHash ());
2405
+ }
2395
2406
}
2396
2407
2397
2408
0 commit comments