mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-20 13:37:28 +02:00
Don't require services in -addnode
This commit is contained in:
parent
5e7ab16d29
commit
15bf863219
6 changed files with 64 additions and 63 deletions
15
src/net.cpp
15
src/net.cpp
|
|
@ -162,7 +162,7 @@ static std::vector<CAddress> convertSeed6(const std::vector<SeedSpec6> &vSeedsIn
|
|||
{
|
||||
struct in6_addr ip;
|
||||
memcpy(&ip, i->addr, sizeof(ip));
|
||||
CAddress addr(CService(ip, i->port));
|
||||
CAddress addr(CService(ip, i->port), NODE_NETWORK);
|
||||
addr.nTime = GetTime() - GetRand(nOneWeek) - nOneWeek;
|
||||
vSeedsOut.push_back(addr);
|
||||
}
|
||||
|
|
@ -179,9 +179,8 @@ CAddress GetLocalAddress(const CNetAddr *paddrPeer)
|
|||
CService addr;
|
||||
if (GetLocal(addr, paddrPeer))
|
||||
{
|
||||
ret = CAddress(addr);
|
||||
ret = CAddress(addr, nLocalServices);
|
||||
}
|
||||
ret.nServices = nLocalServices;
|
||||
ret.nTime = GetAdjustedTime();
|
||||
return ret;
|
||||
}
|
||||
|
|
@ -465,7 +464,7 @@ void CNode::PushVersion()
|
|||
int nBestHeight = GetNodeSignals().GetHeight().get_value_or(0);
|
||||
|
||||
int64_t nTime = (fInbound ? GetAdjustedTime() : GetTime());
|
||||
CAddress addrYou = (addr.IsRoutable() && !IsProxy(addr) ? addr : CAddress(CService("0.0.0.0",0)));
|
||||
CAddress addrYou = (addr.IsRoutable() && !IsProxy(addr) ? addr : CAddress(CService("0.0.0.0",0), addr.nServices));
|
||||
CAddress addrMe = GetLocalAddress(&addr);
|
||||
GetRandBytes((unsigned char*)&nLocalHostNonce, sizeof(nLocalHostNonce));
|
||||
if (fLogIPs)
|
||||
|
|
@ -1441,7 +1440,7 @@ void ThreadDNSAddressSeed()
|
|||
} else {
|
||||
std::vector<CNetAddr> vIPs;
|
||||
std::vector<CAddress> vAdd;
|
||||
uint64_t requiredServiceBits = NODE_NETWORK;
|
||||
uint64_t requiredServiceBits = nRelevantServices;
|
||||
if (LookupHost(seed.getHost(requiredServiceBits).c_str(), vIPs, 0, true))
|
||||
{
|
||||
BOOST_FOREACH(const CNetAddr& ip, vIPs)
|
||||
|
|
@ -1524,7 +1523,7 @@ void ThreadOpenConnections()
|
|||
ProcessOneShot();
|
||||
BOOST_FOREACH(const std::string& strAddr, mapMultiArgs["-connect"])
|
||||
{
|
||||
CAddress addr;
|
||||
CAddress addr(CService(), 0);
|
||||
OpenNetworkConnection(addr, false, NULL, strAddr.c_str());
|
||||
for (int i = 0; i < 10 && i < nLoop; i++)
|
||||
{
|
||||
|
|
@ -1674,7 +1673,9 @@ void ThreadOpenAddedConnections()
|
|||
BOOST_FOREACH(std::vector<CService>& vserv, lservAddressesToAdd)
|
||||
{
|
||||
CSemaphoreGrant grant(*semOutbound);
|
||||
OpenNetworkConnection(CAddress(vserv[i % vserv.size()]), false, &grant);
|
||||
/* We want -addnode to work even for nodes that don't provide all
|
||||
* wanted services, so pass in nServices=0 to CAddress. */
|
||||
OpenNetworkConnection(CAddress(vserv[i % vserv.size()], 0), false, &grant);
|
||||
MilliSleep(500);
|
||||
}
|
||||
MilliSleep(120000); // Retry every 2 minutes
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue