@@ -66,7 +66,7 @@ int AddrInfo::GetBucketPosition(const uint256& nKey, bool fNew, int nBucket) con
66
66
67
67
bool AddrInfo::IsTerrible (int64_t nNow) const
68
68
{
69
- if (nNow - nLastTry <= 60 ) { // never remove things tried in the last minute
69
+ if (nNow - m_last_try <= 60 ) { // never remove things tried in the last minute
70
70
return false ;
71
71
}
72
72
@@ -77,10 +77,10 @@ bool AddrInfo::IsTerrible(int64_t nNow) const
77
77
return true ;
78
78
}
79
79
80
- if (nLastSuccess == 0 && nAttempts >= ADDRMAN_RETRIES) // tried N times and never a success
80
+ if (m_last_success == 0 && nAttempts >= ADDRMAN_RETRIES) // tried N times and never a success
81
81
return true ;
82
82
83
- if (nNow - nLastSuccess > ADDRMAN_MIN_FAIL_DAYS * 24 * 60 * 60 && nAttempts >= ADDRMAN_MAX_FAILURES) // N successive failures in the last week
83
+ if (nNow - m_last_success > ADDRMAN_MIN_FAIL_DAYS * 24 * 60 * 60 && nAttempts >= ADDRMAN_MAX_FAILURES) // N successive failures in the last week
84
84
return true ;
85
85
86
86
return false ;
@@ -91,7 +91,7 @@ double AddrInfo::GetChance(int64_t nNow) const
91
91
double fChance = 1.0 ;
92
92
93
93
// deprioritize very recent attempts away
94
- if (nNow - nLastTry < 60 * 10 ) {
94
+ if (nNow - m_last_try < 60 * 10 ) {
95
95
fChance *= 0.01 ;
96
96
}
97
97
@@ -540,7 +540,7 @@ void AddrManImpl::MakeTried(AddrInfo& info, int nId)
540
540
info.fInTried = true ;
541
541
}
542
542
543
- bool AddrManImpl::AddSingle (const CAddress& addr, const CNetAddr& source, int64_t nTimePenalty )
543
+ bool AddrManImpl::AddSingle (const CAddress& addr, const CNetAddr& source, int64_t time_penalty )
544
544
{
545
545
AssertLockHeld (cs);
546
546
@@ -552,15 +552,15 @@ bool AddrManImpl::AddSingle(const CAddress& addr, const CNetAddr& source, int64_
552
552
553
553
// Do not set a penalty for a source's self-announcement
554
554
if (addr == source) {
555
- nTimePenalty = 0 ;
555
+ time_penalty = 0 ;
556
556
}
557
557
558
558
if (pinfo) {
559
559
// periodically update nTime
560
- bool fCurrentlyOnline = (GetAdjustedTime () - addr.nTime < 24 * 60 * 60 );
561
- int64_t nUpdateInterval = (fCurrentlyOnline ? 60 * 60 : 24 * 60 * 60 );
562
- if (pinfo->nTime < addr.nTime - nUpdateInterval - nTimePenalty ) {
563
- pinfo->nTime = std::max ((int64_t )0 , addr.nTime - nTimePenalty );
560
+ bool currently_online = (GetAdjustedTime () - addr.nTime < 24 * 60 * 60 );
561
+ int64_t update_interval = (currently_online ? 60 * 60 : 24 * 60 * 60 );
562
+ if (pinfo->nTime < addr.nTime - update_interval - time_penalty ) {
563
+ pinfo->nTime = std::max ((int64_t )0 , addr.nTime - time_penalty );
564
564
}
565
565
566
566
// add services
@@ -587,7 +587,7 @@ bool AddrManImpl::AddSingle(const CAddress& addr, const CNetAddr& source, int64_
587
587
return false ;
588
588
} else {
589
589
pinfo = Create (addr, source, &nId);
590
- pinfo->nTime = std::max ((int64_t )0 , (int64_t )pinfo->nTime - nTimePenalty );
590
+ pinfo->nTime = std::max ((int64_t )0 , (int64_t )pinfo->nTime - time_penalty );
591
591
nNew++;
592
592
}
593
593
@@ -623,7 +623,7 @@ bool AddrManImpl::Good_(const CService& addr, bool test_before_evict, int64_t nT
623
623
624
624
int nId;
625
625
626
- nLastGood = nTime;
626
+ m_last_good = nTime;
627
627
628
628
AddrInfo* pinfo = Find (addr, &nId);
629
629
@@ -633,8 +633,8 @@ bool AddrManImpl::Good_(const CService& addr, bool test_before_evict, int64_t nT
633
633
AddrInfo& info = *pinfo;
634
634
635
635
// update info
636
- info.nLastSuccess = nTime;
637
- info.nLastTry = nTime;
636
+ info.m_last_success = nTime;
637
+ info.m_last_try = nTime;
638
638
info.nAttempts = 0 ;
639
639
// nTime is not updated here, to avoid leaking information about
640
640
// currently-connected peers.
@@ -671,11 +671,11 @@ bool AddrManImpl::Good_(const CService& addr, bool test_before_evict, int64_t nT
671
671
}
672
672
}
673
673
674
- bool AddrManImpl::Add_ (const std::vector<CAddress> &vAddr, const CNetAddr& source, int64_t nTimePenalty )
674
+ bool AddrManImpl::Add_ (const std::vector<CAddress> &vAddr, const CNetAddr& source, int64_t time_penalty )
675
675
{
676
676
int added{0 };
677
677
for (std::vector<CAddress>::const_iterator it = vAddr.begin (); it != vAddr.end (); it++) {
678
- added += AddSingle (*it, source, nTimePenalty ) ? 1 : 0 ;
678
+ added += AddSingle (*it, source, time_penalty ) ? 1 : 0 ;
679
679
}
680
680
if (added > 0 ) {
681
681
LogPrint (BCLog::ADDRMAN, " Added %i addresses (of %i) from %s: %i tried, %i new\n " , added, vAddr.size (), source.ToString (), nTried, nNew);
@@ -696,9 +696,9 @@ void AddrManImpl::Attempt_(const CService& addr, bool fCountFailure, int64_t nTi
696
696
AddrInfo& info = *pinfo;
697
697
698
698
// update info
699
- info.nLastTry = nTime;
700
- if (fCountFailure && info.nLastCountAttempt < nLastGood ) {
701
- info.nLastCountAttempt = nTime;
699
+ info.m_last_try = nTime;
700
+ if (fCountFailure && info.m_last_count_attempt < m_last_good ) {
701
+ info.m_last_count_attempt = nTime;
702
702
info.nAttempts ++;
703
703
}
704
704
}
@@ -736,7 +736,7 @@ std::pair<CAddress, int64_t> AddrManImpl::Select_(bool newOnly) const
736
736
// With probability GetChance() * fChanceFactor, return the entry.
737
737
if (insecure_rand.randbits (30 ) < fChanceFactor * info.GetChance () * (1 << 30 )) {
738
738
LogPrint (BCLog::ADDRMAN, " Selected %s from tried\n " , info.ToString ());
739
- return {info, info.nLastTry };
739
+ return {info, info.m_last_try };
740
740
}
741
741
// Otherwise start over with a (likely) different bucket, and increased chance factor.
742
742
fChanceFactor *= 1.2 ;
@@ -764,7 +764,7 @@ std::pair<CAddress, int64_t> AddrManImpl::Select_(bool newOnly) const
764
764
// With probability GetChance() * fChanceFactor, return the entry.
765
765
if (insecure_rand.randbits (30 ) < fChanceFactor * info.GetChance () * (1 << 30 )) {
766
766
LogPrint (BCLog::ADDRMAN, " Selected %s from new\n " , info.ToString ());
767
- return {info, info.nLastTry };
767
+ return {info, info.m_last_try };
768
768
}
769
769
// Otherwise start over with a (likely) different bucket, and increased chance factor.
770
770
fChanceFactor *= 1.2 ;
@@ -823,8 +823,8 @@ void AddrManImpl::Connected_(const CService& addr, int64_t nTime)
823
823
AddrInfo& info = *pinfo;
824
824
825
825
// update info
826
- int64_t nUpdateInterval = 20 * 60 ;
827
- if (nTime - info.nTime > nUpdateInterval )
826
+ int64_t update_interval = 20 * 60 ;
827
+ if (nTime - info.nTime > update_interval )
828
828
info.nTime = nTime;
829
829
}
830
830
@@ -873,19 +873,19 @@ void AddrManImpl::ResolveCollisions_()
873
873
const auto current_time{GetAdjustedTime ()};
874
874
875
875
// Has successfully connected in last X hours
876
- if (current_time - info_old.nLastSuccess < ADDRMAN_REPLACEMENT_HOURS*(60 *60 )) {
876
+ if (current_time - info_old.m_last_success < ADDRMAN_REPLACEMENT_HOURS*(60 *60 )) {
877
877
erase_collision = true ;
878
- } else if (current_time - info_old.nLastTry < ADDRMAN_REPLACEMENT_HOURS*(60 *60 )) { // attempted to connect and failed in last X hours
878
+ } else if (current_time - info_old.m_last_try < ADDRMAN_REPLACEMENT_HOURS*(60 *60 )) { // attempted to connect and failed in last X hours
879
879
880
880
// Give address at least 60 seconds to successfully connect
881
- if (current_time - info_old.nLastTry > 60 ) {
881
+ if (current_time - info_old.m_last_try > 60 ) {
882
882
LogPrint (BCLog::ADDRMAN, " Replacing %s with %s in tried table\n " , info_old.ToString (), info_new.ToString ());
883
883
884
884
// Replaces an existing address already in the tried table with the new address
885
885
Good_ (info_new, false , current_time);
886
886
erase_collision = true ;
887
887
}
888
- } else if (current_time - info_new.nLastSuccess > ADDRMAN_TEST_WINDOW) {
888
+ } else if (current_time - info_new.m_last_success > ADDRMAN_TEST_WINDOW) {
889
889
// If the collision hasn't resolved in some reasonable amount of time,
890
890
// just evict the old entry -- we must not be able to
891
891
// connect to it for some reason.
@@ -932,7 +932,7 @@ std::pair<CAddress, int64_t> AddrManImpl::SelectTriedCollision_()
932
932
int tried_bucket_pos = newInfo.GetBucketPosition (nKey, false , tried_bucket);
933
933
934
934
const AddrInfo& info_old = mapInfo[vvTried[tried_bucket][tried_bucket_pos]];
935
- return {info_old, info_old.nLastTry };
935
+ return {info_old, info_old.m_last_try };
936
936
}
937
937
938
938
std::optional<AddressPosition> AddrManImpl::FindAddressEntry_ (const CAddress& addr)
@@ -990,7 +990,7 @@ int AddrManImpl::CheckAddrman() const
990
990
int n = entry.first ;
991
991
const AddrInfo& info = entry.second ;
992
992
if (info.fInTried ) {
993
- if (!info.nLastSuccess )
993
+ if (!info.m_last_success )
994
994
return -1 ;
995
995
if (info.nRefCount )
996
996
return -2 ;
@@ -1008,9 +1008,9 @@ int AddrManImpl::CheckAddrman() const
1008
1008
}
1009
1009
if (info.nRandomPos < 0 || (size_t )info.nRandomPos >= vRandom.size () || vRandom[info.nRandomPos ] != n)
1010
1010
return -14 ;
1011
- if (info.nLastTry < 0 )
1011
+ if (info.m_last_try < 0 )
1012
1012
return -6 ;
1013
- if (info.nLastSuccess < 0 )
1013
+ if (info.m_last_success < 0 )
1014
1014
return -8 ;
1015
1015
}
1016
1016
@@ -1067,11 +1067,11 @@ size_t AddrManImpl::size() const
1067
1067
return vRandom.size ();
1068
1068
}
1069
1069
1070
- bool AddrManImpl::Add (const std::vector<CAddress>& vAddr, const CNetAddr& source, int64_t nTimePenalty )
1070
+ bool AddrManImpl::Add (const std::vector<CAddress>& vAddr, const CNetAddr& source, int64_t time_penalty )
1071
1071
{
1072
1072
LOCK (cs);
1073
1073
Check ();
1074
- auto ret = Add_ (vAddr, source, nTimePenalty );
1074
+ auto ret = Add_ (vAddr, source, time_penalty );
1075
1075
Check ();
1076
1076
return ret;
1077
1077
}
@@ -1184,9 +1184,9 @@ size_t AddrMan::size() const
1184
1184
return m_impl->size ();
1185
1185
}
1186
1186
1187
- bool AddrMan::Add (const std::vector<CAddress>& vAddr, const CNetAddr& source, int64_t nTimePenalty )
1187
+ bool AddrMan::Add (const std::vector<CAddress>& vAddr, const CNetAddr& source, int64_t time_penalty )
1188
1188
{
1189
- return m_impl->Add (vAddr, source, nTimePenalty );
1189
+ return m_impl->Add (vAddr, source, time_penalty );
1190
1190
}
1191
1191
1192
1192
bool AddrMan::Good (const CService& addr, int64_t nTime)
0 commit comments