@ -2145,9 +2145,12 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr
}
}
bool fNewBlock = false ;
bool fNewBlock = false ;
ProcessNewBlock ( chainparams , pblock , true , & fNewBlock ) ;
ProcessNewBlock ( chainparams , pblock , true , & fNewBlock ) ;
if ( fNewBlock )
if ( fNewBlock ) {
pfrom - > nLastBlockTime = GetTime ( ) ;
pfrom - > nLastBlockTime = GetTime ( ) ;
} else {
LOCK ( cs_main ) ;
mapBlockSource . erase ( pblock - > GetHash ( ) ) ;
}
LOCK ( cs_main ) ; // hold cs_main for CBlockIndex::IsValid()
LOCK ( cs_main ) ; // hold cs_main for CBlockIndex::IsValid()
if ( pindex - > IsValid ( BLOCK_VALID_TRANSACTIONS ) ) {
if ( pindex - > IsValid ( BLOCK_VALID_TRANSACTIONS ) ) {
// Clear download state for this block, which is in
// Clear download state for this block, which is in
@ -2222,8 +2225,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,
// 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)
// even if it would not be a candidate for new tip (missing previous block, chain not long enough, etc)
ProcessNewBlock ( chainparams , pblock , true , & fNewBlock ) ;
ProcessNewBlock ( chainparams , pblock , true , & fNewBlock ) ;
if ( fNewBlock )
if ( fNewBlock ) {
pfrom - > nLastBlockTime = GetTime ( ) ;
pfrom - > nLastBlockTime = GetTime ( ) ;
} else {
LOCK ( cs_main ) ;
mapBlockSource . erase ( pblock - > GetHash ( ) ) ;
}
}
}
}
}
@ -2401,8 +2408,12 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr
}
}
bool fNewBlock = false ;
bool fNewBlock = false ;
ProcessNewBlock ( chainparams , pblock , forceProcessing , & fNewBlock ) ;
ProcessNewBlock ( chainparams , pblock , forceProcessing , & fNewBlock ) ;
if ( fNewBlock )
if ( fNewBlock ) {
pfrom - > nLastBlockTime = GetTime ( ) ;
pfrom - > nLastBlockTime = GetTime ( ) ;
} else {
LOCK ( cs_main ) ;
mapBlockSource . erase ( pblock - > GetHash ( ) ) ;
}
}
}