Otherwise we may leave them dangling.
Credit TheBlueMatt.
Otherwise we may leave them dangling.
Credit TheBlueMatt.
Credit TheBlueMatt
2133 | @@ -2134,9 +2134,12 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr 2134 | } 2135 | bool fNewBlock = false; 2136 | ProcessNewBlock(chainparams, pblock, true, &fNewBlock); 2137 | - if (fNewBlock) 2138 | + if (fNewBlock) { 2139 | pfrom->nLastBlockTime = GetTime(); 2140 | - 2141 | + } else { 2142 | + LOCK(cs_main);
Nit, move the lock up and remove the one below?
Nit, reword Remove existing blocks from mapBlockSource?
2396 | @@ -2390,8 +2397,12 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr 2397 | } 2398 | bool fNewBlock = false; 2399 | ProcessNewBlock(chainparams, pblock, forceProcessing, &fNewBlock); 2400 | - if (fNewBlock) 2401 | + if (fNewBlock) {
Would be nice to factor this out to a function, as we're repeating exactly the same code three times.
Would you like me to do that here? Either way works for me.
I don't care strongly, I'm fine with having this as quick fix only. But it feels a tad brittle.
I believe that @TheBlueMatt had plans to clean this up further (or remove the need) in the future, so if it's all the same, I'd prefer to leave it as-is for 0.15.
utACK 3f8fa7f58b68a8ed596c62d1edb85a3455a5a724