@@ -1329,7 +1329,7 @@ static void RelayAddress(const CAddress& addr, bool fReachable, CConnman* connma
1329
1329
assert (nRelayNodes <= best.size ());
1330
1330
1331
1331
auto sortfunc = [&best, &hasher, nRelayNodes](CNode* pnode) {
1332
- if (pnode->nVersion >= CADDR_TIME_VERSION) {
1332
+ if (pnode->nVersion >= CADDR_TIME_VERSION && pnode-> IsAddrRelayPeer () ) {
1333
1333
uint64_t hashKey = CSipHasher (hasher).Write (pnode->GetId ()).Finalize ();
1334
1334
for (unsigned int i = 0 ; i < nRelayNodes; i++) {
1335
1335
if (hashKey > best[i].first ) {
@@ -2018,7 +2018,7 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr
2018
2018
UpdatePreferredDownload (pfrom, State (pfrom->GetId ()));
2019
2019
}
2020
2020
2021
- if (!pfrom->fInbound )
2021
+ if (!pfrom->fInbound && pfrom-> IsAddrRelayPeer () )
2022
2022
{
2023
2023
// Advertise our address
2024
2024
if (fListen && !::ChainstateActive ().IsInitialBlockDownload ())
@@ -2134,6 +2134,9 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr
2134
2134
// Don't want addr from older versions unless seeding
2135
2135
if (pfrom->nVersion < CADDR_TIME_VERSION && connman->GetAddressCount () > 1000 )
2136
2136
return true ;
2137
+ if (!pfrom->IsAddrRelayPeer ()) {
2138
+ return true ;
2139
+ }
2137
2140
if (vAddr.size () > 1000 )
2138
2141
{
2139
2142
LOCK (cs_main);
@@ -2994,6 +2997,10 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr
2994
2997
LogPrint (BCLog::NET, " Ignoring \" getaddr\" from outbound connection. peer=%d\n " , pfrom->GetId ());
2995
2998
return true ;
2996
2999
}
3000
+ if (!pfrom->IsAddrRelayPeer ()) {
3001
+ LogPrint (BCLog::NET, " Ignoring \" getaddr\" from block-relay-only connection. peer=%d\n " , pfrom->GetId ());
3002
+ return true ;
3003
+ }
2997
3004
2998
3005
// Only send one GetAddr response per connection to reduce resource waste
2999
3006
// and discourage addr stamping of INV announcements.
@@ -3587,15 +3594,15 @@ bool PeerLogicValidation::SendMessages(CNode* pto)
3587
3594
3588
3595
// Address refresh broadcast
3589
3596
int64_t nNow = GetTimeMicros ();
3590
- if (!::ChainstateActive ().IsInitialBlockDownload () && pto->nNextLocalAddrSend < nNow) {
3597
+ if (pto-> IsAddrRelayPeer () && !::ChainstateActive ().IsInitialBlockDownload () && pto->nNextLocalAddrSend < nNow) {
3591
3598
AdvertiseLocal (pto);
3592
3599
pto->nNextLocalAddrSend = PoissonNextSend (nNow, AVG_LOCAL_ADDRESS_BROADCAST_INTERVAL);
3593
3600
}
3594
3601
3595
3602
//
3596
3603
// Message: addr
3597
3604
//
3598
- if (pto->nNextAddrSend < nNow) {
3605
+ if (pto->IsAddrRelayPeer () && pto-> nNextAddrSend < nNow) {
3599
3606
pto->nNextAddrSend = PoissonNextSend (nNow, AVG_ADDRESS_BROADCAST_INTERVAL);
3600
3607
std::vector<CAddress> vAddr;
3601
3608
vAddr.reserve (pto->vAddrToSend .size ());
0 commit comments