- 
                Notifications
    You must be signed in to change notification settings 
- Fork 1.2k
A few devnet related fixes #2168
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
a15e906
              5cfad62
              2d1ecdb
              4b072c9
              795f1ee
              File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
|  | @@ -348,8 +348,9 @@ bool CConnman::CheckIncomingNonce(uint64_t nonce) | |
| CNode* CConnman::ConnectNode(CAddress addrConnect, const char *pszDest, bool fCountFailure) | ||
| { | ||
| if (pszDest == NULL) { | ||
| if (IsLocal(addrConnect)) | ||
| if (IsLocal(addrConnect) && (!Params().AllowMultiplePorts() || addrConnect.GetPort() == GetListenPort())) { | ||
| return NULL; | ||
| } | ||
|  | ||
| // Look for an existing connection | ||
| CNode* pnode = FindNode((CService)addrConnect); | ||
|  | @@ -1786,7 +1787,11 @@ void CConnman::ThreadOpenConnections() | |
| CAddrInfo addr = addrman.Select(fFeeler); | ||
|  | ||
| // if we selected an invalid address, restart | ||
| if (!addr.IsValid() || setConnected.count(addr.GetGroup()) || IsLocal(addr)) | ||
| if (!addr.IsValid() || setConnected.count(addr.GetGroup())) | ||
| break; | ||
|  | ||
| // if we selected a local address, restart (local addresses are allowed in regtest and devnet) | ||
| if (IsLocal(addr) && (!Params().AllowMultiplePorts() || addr.GetPort() == GetListenPort())) | ||
|          | ||
| break; | ||
|  | ||
| // If we didn't find an appropriate destination after trying 100 addresses fetched from addrman, | ||
|  | @@ -1990,10 +1995,14 @@ bool CConnman::OpenNetworkConnection(const CAddress& addrConnect, bool fCountFai | |
| return false; | ||
| } | ||
| if (!pszDest) { | ||
| if (IsLocal(addrConnect) || | ||
| FindNode((CNetAddr)addrConnect) || IsBanned(addrConnect) || | ||
| if (IsBanned(addrConnect) || | ||
| FindNode(addrConnect.ToStringIPPort())) | ||
| return false; | ||
| if (IsLocal(addrConnect) && (!Params().AllowMultiplePorts() || addrConnect.GetPort() == GetListenPort())) | ||
|          | ||
| return false; | ||
| if ((!Params().AllowMultiplePorts() && FindNode((CNetAddr)addrConnect)) || | ||
| (Params().AllowMultiplePorts() && FindNode((CService)addrConnect))) | ||
| return false; | ||
| } else if (FindNode(std::string(pszDest))) | ||
| return false; | ||
|  | ||
|  | @@ -2238,7 +2247,9 @@ void CConnman::SetNetworkActive(bool active) | |
| uiInterface.NotifyNetworkActiveChanged(fNetworkActive); | ||
| } | ||
|  | ||
| CConnman::CConnman(uint64_t nSeed0In, uint64_t nSeed1In) : nSeed0(nSeed0In), nSeed1(nSeed1In) | ||
| CConnman::CConnman(uint64_t nSeed0In, uint64_t nSeed1In) : | ||
| nSeed0(nSeed0In), nSeed1(nSeed1In), | ||
| addrman(Params().AllowMultiplePorts()) | ||
| { | ||
| fNetworkActive = true; | ||
| setBannedIsDirty = false; | ||
|  | ||
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
|  | @@ -92,7 +92,7 @@ BOOST_AUTO_TEST_CASE(caddrdb_read) | |
| // Test that the de-serialization does not throw an exception. | ||
| CDataStream ssPeers1 = AddrmanToStream(addrmanUncorrupted); | ||
| bool exceptionThrown = false; | ||
| CAddrMan addrman1; | ||
| CAddrMan addrman1(false); | ||
|          | ||
|  | ||
| BOOST_CHECK(addrman1.size() == 0); | ||
| try { | ||
|  | @@ -109,7 +109,7 @@ BOOST_AUTO_TEST_CASE(caddrdb_read) | |
| // Test that CAddrDB::Read creates an addrman with the correct number of addrs. | ||
| CDataStream ssPeers2 = AddrmanToStream(addrmanUncorrupted); | ||
|  | ||
| CAddrMan addrman2; | ||
| CAddrMan addrman2(false); | ||
| CAddrDB adb; | ||
| BOOST_CHECK(addrman2.size() == 0); | ||
| adb.Read(addrman2, ssPeers2); | ||
|  | @@ -125,7 +125,7 @@ BOOST_AUTO_TEST_CASE(caddrdb_read_corrupted) | |
| // Test that the de-serialization of corrupted addrman throws an exception. | ||
| CDataStream ssPeers1 = AddrmanToStream(addrmanCorrupted); | ||
| bool exceptionThrown = false; | ||
| CAddrMan addrman1; | ||
| CAddrMan addrman1(false); | ||
| BOOST_CHECK(addrman1.size() == 0); | ||
| try { | ||
| unsigned char pchMsgTmp[4]; | ||
|  | @@ -141,7 +141,7 @@ BOOST_AUTO_TEST_CASE(caddrdb_read_corrupted) | |
| // Test that CAddrDB::Read leaves addrman in a clean state if de-serialization fails. | ||
| CDataStream ssPeers2 = AddrmanToStream(addrmanCorrupted); | ||
|  | ||
| CAddrMan addrman2; | ||
| CAddrMan addrman2(false); | ||
| CAddrDB adb; | ||
| BOOST_CHECK(addrman2.size() == 0); | ||
| adb.Read(addrman2, ssPeers2); | ||
|  | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's too hard to read, maybe
?