Skip to content
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

refactor: implement minimal RelayInv which doesn't rely on m_connman #6427

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

PastaPastaPasta
Copy link
Member

Issue being fixed or feature implemented

Vast majority of usages of RelayInv don't use the minProtoVersion, we may as well have these not contribute to contention of m_nodes_mutex / use m_connman

What was done?

new implementation of RelayInv which doesn't rely on m_connman

How Has This Been Tested?

See CI

Breaking Changes

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated relevant unit/integration/functional/e2e tests
  • I have made corresponding changes to the documentation
  • I have assigned this pull request to a milestone (for repository code-owners and collaborators only)

Vast majority of usages of RelayInv don't use the minProtoVersion, we may as well have these not contribute to contention of m_nodes_mutex / use m_connman
@PastaPastaPasta PastaPastaPasta added this to the 22.1 milestone Nov 23, 2024
Copy link

@UdjinM6 UdjinM6 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utACK a7cd23e

Copy link
Collaborator

@kwvg kwvg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utACK a7cd23e

@@ -94,7 +94,8 @@ class PeerManager : public CValidationInterface, public NetEventsInterface
virtual void PushInventory(NodeId nodeid, const CInv& inv) = 0;

/** Relay inventories to all peers */
virtual void RelayInv(CInv &inv, const int minProtoVersion = MIN_PEER_PROTO_VERSION) = 0;
virtual void RelayInv(CInv &inv) = 0;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it breaking change? It means that some messages can be send to peers even if version is lower than MIN_PEER_PROTO_VERSION... Will it work fine?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Peers with a version lower than this are disconnected asap:
https://github.com/dashpay/dash/blob/develop/src/version.h#L19-L20
https://github.com/dashpay/dash/blob/develop/src/net_processing.cpp#L3447-L3452

Side note: this made me wonder what versions are used in RelayInv() calls and we might want to change this line https://github.com/dashpay/dash/blob/develop/src/net_processing.cpp#L3394 so that PostProcessMessage() would use the fast variant too:

-        RelayInv(result.m_inventory.value(), MIN_PEER_PROTO_VERSION);
+        RelayInv(result.m_inventory.value());

Can be done here or in a follow-up PR.

Copy link
Collaborator

@knst knst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utACK a7cd23e

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants