@@ -66,7 +66,7 @@ int AddrInfo::GetBucketPosition(const uint256& nKey, bool fNew, int nBucket) con
6666
6767bool AddrInfo::IsTerrible (int64_t nNow) const
6868{
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
7070 return false ;
7171 }
7272
@@ -77,10 +77,10 @@ bool AddrInfo::IsTerrible(int64_t nNow) const
7777 return true ;
7878 }
7979
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
8181 return true ;
8282
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
8484 return true ;
8585
8686 return false ;
@@ -91,7 +91,7 @@ double AddrInfo::GetChance(int64_t nNow) const
9191 double fChance = 1.0 ;
9292
9393 // deprioritize very recent attempts away
94- if (nNow - nLastTry < 60 * 10 ) {
94+ if (nNow - m_last_try < 60 * 10 ) {
9595 fChance *= 0.01 ;
9696 }
9797
@@ -540,7 +540,7 @@ void AddrManImpl::MakeTried(AddrInfo& info, int nId)
540540 info.fInTried = true ;
541541}
542542
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 )
544544{
545545 AssertLockHeld (cs);
546546
@@ -552,15 +552,15 @@ bool AddrManImpl::AddSingle(const CAddress& addr, const CNetAddr& source, int64_
552552
553553 // Do not set a penalty for a source's self-announcement
554554 if (addr == source) {
555- nTimePenalty = 0 ;
555+ time_penalty = 0 ;
556556 }
557557
558558 if (pinfo) {
559559 // 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 );
564564 }
565565
566566 // add services
@@ -587,7 +587,7 @@ bool AddrManImpl::AddSingle(const CAddress& addr, const CNetAddr& source, int64_
587587 return false ;
588588 } else {
589589 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 );
591591 nNew++;
592592 }
593593
@@ -623,7 +623,7 @@ bool AddrManImpl::Good_(const CService& addr, bool test_before_evict, int64_t nT
623623
624624 int nId;
625625
626- nLastGood = nTime;
626+ m_last_good = nTime;
627627
628628 AddrInfo* pinfo = Find (addr, &nId);
629629
@@ -633,8 +633,8 @@ bool AddrManImpl::Good_(const CService& addr, bool test_before_evict, int64_t nT
633633 AddrInfo& info = *pinfo;
634634
635635 // update info
636- info.nLastSuccess = nTime;
637- info.nLastTry = nTime;
636+ info.m_last_success = nTime;
637+ info.m_last_try = nTime;
638638 info.nAttempts = 0 ;
639639 // nTime is not updated here, to avoid leaking information about
640640 // currently-connected peers.
@@ -671,11 +671,11 @@ bool AddrManImpl::Good_(const CService& addr, bool test_before_evict, int64_t nT
671671 }
672672}
673673
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 )
675675{
676676 int added{0 };
677677 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 ;
679679 }
680680 if (added > 0 ) {
681681 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
696696 AddrInfo& info = *pinfo;
697697
698698 // 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;
702702 info.nAttempts ++;
703703 }
704704}
@@ -736,7 +736,7 @@ std::pair<CAddress, int64_t> AddrManImpl::Select_(bool newOnly) const
736736 // With probability GetChance() * fChanceFactor, return the entry.
737737 if (insecure_rand.randbits (30 ) < fChanceFactor * info.GetChance () * (1 << 30 )) {
738738 LogPrint (BCLog::ADDRMAN, " Selected %s from tried\n " , info.ToString ());
739- return {info, info.nLastTry };
739+ return {info, info.m_last_try };
740740 }
741741 // Otherwise start over with a (likely) different bucket, and increased chance factor.
742742 fChanceFactor *= 1.2 ;
@@ -764,7 +764,7 @@ std::pair<CAddress, int64_t> AddrManImpl::Select_(bool newOnly) const
764764 // With probability GetChance() * fChanceFactor, return the entry.
765765 if (insecure_rand.randbits (30 ) < fChanceFactor * info.GetChance () * (1 << 30 )) {
766766 LogPrint (BCLog::ADDRMAN, " Selected %s from new\n " , info.ToString ());
767- return {info, info.nLastTry };
767+ return {info, info.m_last_try };
768768 }
769769 // Otherwise start over with a (likely) different bucket, and increased chance factor.
770770 fChanceFactor *= 1.2 ;
@@ -823,8 +823,8 @@ void AddrManImpl::Connected_(const CService& addr, int64_t nTime)
823823 AddrInfo& info = *pinfo;
824824
825825 // 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 )
828828 info.nTime = nTime;
829829}
830830
@@ -873,19 +873,19 @@ void AddrManImpl::ResolveCollisions_()
873873 const auto current_time{GetAdjustedTime ()};
874874
875875 // 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 )) {
877877 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
879879
880880 // 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 ) {
882882 LogPrint (BCLog::ADDRMAN, " Replacing %s with %s in tried table\n " , info_old.ToString (), info_new.ToString ());
883883
884884 // Replaces an existing address already in the tried table with the new address
885885 Good_ (info_new, false , current_time);
886886 erase_collision = true ;
887887 }
888- } else if (current_time - info_new.nLastSuccess > ADDRMAN_TEST_WINDOW) {
888+ } else if (current_time - info_new.m_last_success > ADDRMAN_TEST_WINDOW) {
889889 // If the collision hasn't resolved in some reasonable amount of time,
890890 // just evict the old entry -- we must not be able to
891891 // connect to it for some reason.
@@ -932,7 +932,7 @@ std::pair<CAddress, int64_t> AddrManImpl::SelectTriedCollision_()
932932 int tried_bucket_pos = newInfo.GetBucketPosition (nKey, false , tried_bucket);
933933
934934 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 };
936936}
937937
938938std::optional<AddressPosition> AddrManImpl::FindAddressEntry_ (const CAddress& addr)
@@ -990,7 +990,7 @@ int AddrManImpl::CheckAddrman() const
990990 int n = entry.first ;
991991 const AddrInfo& info = entry.second ;
992992 if (info.fInTried ) {
993- if (!info.nLastSuccess )
993+ if (!info.m_last_success )
994994 return -1 ;
995995 if (info.nRefCount )
996996 return -2 ;
@@ -1008,9 +1008,9 @@ int AddrManImpl::CheckAddrman() const
10081008 }
10091009 if (info.nRandomPos < 0 || (size_t )info.nRandomPos >= vRandom.size () || vRandom[info.nRandomPos ] != n)
10101010 return -14 ;
1011- if (info.nLastTry < 0 )
1011+ if (info.m_last_try < 0 )
10121012 return -6 ;
1013- if (info.nLastSuccess < 0 )
1013+ if (info.m_last_success < 0 )
10141014 return -8 ;
10151015 }
10161016
@@ -1067,11 +1067,11 @@ size_t AddrManImpl::size() const
10671067 return vRandom.size ();
10681068}
10691069
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 )
10711071{
10721072 LOCK (cs);
10731073 Check ();
1074- auto ret = Add_ (vAddr, source, nTimePenalty );
1074+ auto ret = Add_ (vAddr, source, time_penalty );
10751075 Check ();
10761076 return ret;
10771077}
@@ -1184,9 +1184,9 @@ size_t AddrMan::size() const
11841184 return m_impl->size ();
11851185}
11861186
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 )
11881188{
1189- return m_impl->Add (vAddr, source, nTimePenalty );
1189+ return m_impl->Add (vAddr, source, time_penalty );
11901190}
11911191
11921192bool AddrMan::Good (const CService& addr, int64_t nTime)
0 commit comments