@ -3675,7 +3675,6 @@ bool static AlreadyHave(const CInv& inv)
return true ;
return true ;
}
}
void static ProcessGetData ( CNode * pfrom )
void static ProcessGetData ( CNode * pfrom )
{
{
std : : deque < CInv > : : iterator it = pfrom - > vRecvGetData . begin ( ) ;
std : : deque < CInv > : : iterator it = pfrom - > vRecvGetData . begin ( ) ;
@ -3703,11 +3702,13 @@ void static ProcessGetData(CNode* pfrom)
if ( chainActive . Contains ( mi - > second ) ) {
if ( chainActive . Contains ( mi - > second ) ) {
send = true ;
send = true ;
} else {
} else {
static const int nOneMonth = 30 * 24 * 60 * 60 ;
// To prevent fingerprinting attacks, only send blocks outside of the active
// To prevent fingerprinting attacks, only send blocks outside of the active
// chain if they are valid, and no more than a month older than the best header
// chain if they are valid, and no more than a month older (both in time, and in
// chain we know about.
// best equivalent proof of work) than the best header chain we know about.
send = mi - > second - > IsValid ( BLOCK_VALID_SCRIPTS ) & & ( pindexBestHeader ! = NULL ) & &
send = mi - > second - > IsValid ( BLOCK_VALID_SCRIPTS ) & & ( pindexBestHeader ! = NULL ) & &
( mi - > second - > GetBlockTime ( ) > pindexBestHeader - > GetBlockTime ( ) - 30 * 24 * 60 * 60 ) ;
( pindexBestHeader - > GetBlockTime ( ) - mi - > second - > GetBlockTime ( ) < nOneMonth ) & &
( GetBlockProofEquivalentTime ( * pindexBestHeader , * mi - > second , * pindexBestHeader , Params ( ) . GetConsensus ( ) ) < nOneMonth ) ;
if ( ! send ) {
if ( ! send ) {
LogPrintf ( " %s: ignoring request from peer=%i for old block that isn't in the main chain \n " , __func__ , pfrom - > GetId ( ) ) ;
LogPrintf ( " %s: ignoring request from peer=%i for old block that isn't in the main chain \n " , __func__ , pfrom - > GetId ( ) ) ;
}
}