@ -1455,13 +1455,13 @@ bool OpenNetworkConnection(const CAddress& addrConnect, CSemaphoreGrant *grantOu
// for now, use a very simple selection metric: the node from which we received
// for now, use a very simple selection metric: the node from which we received
// most recently
// most recently
double static NodeSyncScore ( const CNode * pnode ) {
static int64_t NodeSyncScore ( const CNode * pnode ) {
return - pnode - > nLastRecv ;
return pnode - > nLastRecv ;
}
}
void static StartSync ( const vector < CNode * > & vNodes ) {
void static StartSync ( const vector < CNode * > & vNodes ) {
CNode * pnodeNewSync = NULL ;
CNode * pnodeNewSync = NULL ;
double d BestScore = 0 ;
int64_t n BestScore = 0 ;
int nBestHeight = g_signals . GetHeight ( ) . get_value_or ( 0 ) ;
int nBestHeight = g_signals . GetHeight ( ) . get_value_or ( 0 ) ;
@ -1473,10 +1473,10 @@ void static StartSync(const vector<CNode*> &vNodes) {
( pnode - > nStartingHeight > ( nBestHeight - 144 ) ) & &
( pnode - > nStartingHeight > ( nBestHeight - 144 ) ) & &
( pnode - > nVersion < NOBLKS_VERSION_START | | pnode - > nVersion > = NOBLKS_VERSION_END ) ) {
( pnode - > nVersion < NOBLKS_VERSION_START | | pnode - > nVersion > = NOBLKS_VERSION_END ) ) {
// if ok, compare node's score with the best so far
// if ok, compare node's score with the best so far
double d Score = NodeSyncScore ( pnode ) ;
int64_t n Score = NodeSyncScore ( pnode ) ;
if ( pnodeNewSync = = NULL | | dScore > d BestScore) {
if ( pnodeNewSync = = NULL | | nScore > n BestScore) {
pnodeNewSync = pnode ;
pnodeNewSync = pnode ;
dBestScore = d Score;
nBestScore = n Score;
}
}
}
}
}
}