8000 [Upstream] [P2P][RPC] Rework addnode behaviour by lyricidal · Pull Request #174 · PRCYCoin/PRCYCoin · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

[Upstream] [P2P][RPC] Rework addnode behaviour #174

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

Merged
merged 2 commits into from
Dec 20, 2021

Conversation

lyricidal
Copy link

Another one as part of #4

Partial backport of bitcoin#8113 as part of #1374.

Original Description:

  • Maintains consistency between ThreadOpenAddedNodeConnections and getaddednodeinfo, without any DNS resolving from RPC.
  • Deals with the use case of added names whose IP mapping changes over time (switching over to the new IP only when the connection to the old one closes, though).
  • Gets rid of the fDns argument to getaddednodeinfo (turning it into a dummy)
  • Simplifies the code significantly by introducing a shared GetAddedNodeInfo in net.cpp.
  • The existing addnode logic that tries all resolved addresses for a name is pushed down into ConnectSocketByName (picking at random).
  • The existing addnode logic to prevent multiple connections to the same IP is pushed down into ConnectNode (by storing colliding names into the CNode's addrName field).

I omitted the last point (commit f9f5cfc) as it conflicts with how our current regtest tests function.

from PIVX-Project/PIVX#1640

< 8000 div class="pr-1 flex-shrink-0" style="width: 16px;">
* Use CNode::addeName to track whether a connection to a name is already open
  * A new connection to a previously-connected by-name addednode is only opened when
    the previous one closes (even if the name starts resolving to something else)
  * At most one connection is opened per addednode (even if the name resolves to multiple)
* Unify the code between ThreadOpenAddedNodeConnections and getaddednodeinfo
  * Information about open connections is always returned, and the dns argument becomes a dummy
  * An IP address and inbound/outbound is only reported for the (at most 1) open connection
@lyricidal lyricidal added the Upstream Upstream backports/fixes label Dec 20, 2021
@lyricidal lyricidal requested review from lopeed and anprdev December 20, 2021 20:41
@lopeed lopeed merged commit 3684cd8 into develop Dec 20, 2021
@lopeed lopeed deleted the upstream-saneaddednode branch December 20, 2021 20:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Upstream Upstream backports/fixes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0