@@ -3872,9 +3872,9 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
3872
3872
3873
3873
3874
3874
3875
+ pfrom->addrLocal = addrMe;
3875
3876
if (pfrom->fInbound && addrMe.IsRoutable ())
3876
3877
{
3877
- pfrom->addrLocal = addrMe;
3878
3878
SeenLocal (addrMe);
3879
3879
}
3880
3880
@@ -3912,9 +3912,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
3912
3912
// Advertise our address
3913
3913
if (!fNoListen && !IsInitialBlockDownload ())
3914
3914
{
3915
- CAddress addr = GetLocalAddress (&pfrom->addr );
3916
- if (addr.IsRoutable ())
3917
- pfrom->PushAddress (addr);
3915
+ AdvertiseLocal (pfrom);
3918
3916
}
3919
3917
3920
3918
// Get recent addresses
@@ -4737,27 +4735,19 @@ bool SendMessages(CNode* pto, bool fSendTrickle)
4737
4735
ResendWalletTransactions ();
4738
4736
4739
4737
// Address refresh broadcast
4740
- static int64_t nLastRebroadcast;
4741
- if (!IsInitialBlockDownload () && ( GetAdjustedTime () - nLastRebroadcast > 24 * 60 * 60 ))
4738
+ if (!IsInitialBlockDownload ())
4742
4739
{
4740
+ if (GetAdjustedTime () > pto->nNextRebroadcastTime )
4743
4741
{
4744
- LOCK (cs_vNodes);
4745
- for (auto const & pnode : vNodes)
4742
+ // Periodically clear setAddrKnown to allow refresh broadcasts
4743
+ // pnode->setAddrKnown.clear();
4744
+ // Rebroadcast our address
4745
+ if (!fNoListen )
4746
4746
{
4747
- // Periodically clear setAddrKnown to allow refresh broadcasts
4748
- if (nLastRebroadcast)
4749
- pnode->setAddrKnown .clear ();
4750
-
4751
- // Rebroadcast our address
4752
- if (!fNoListen )
4753
- {
4754
- CAddress addr = GetLocalAddress (&pnode->addr );
4755
- if (addr.IsRoutable ())
4756
- pnode->PushAddress (addr);
4757
- }
4747
+ AdvertiseLocal (pto);
4748
+ pto->nNextRebroadcastTime = GetAdjustedTime () + 12 *60 *60 + GetRand (12 *60 *60 );
4758
4749
}
4759
4750
}
4760
- nLastRebroadcast = GetAdjustedTime ();
4761
4751
}
4762
4752
4763
4753
//
0 commit comments