-
Notifications
You must be signed in to change notification settings - Fork 37.7k
net processing: don't request tx relay on feeler connections #22777
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
Conversation
Previously attempted in #9403, which was abandoned by the author. |
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
rebased |
e064b1b
to
b9f26e7
Compare
Concept ACK. Approach ACK.
|
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.
If I understand it correctly, the problem solved here is that our feeler peer might assemble/send out unnecessary tx announcements in the short time before they notice that they got disconnected.
Aren't tx invs are just one of several unnecessary messages? e.g. we also send them an GETADDR before disconnecting, so that they might prepare an answer which we'll never receive. So I wonder if a more general solution would make sense. (would it maybe work to skip sending VERACK to feelers?)
Not quite. The This PR is maybe better understood when considered alongside #22778, where we'll save having to allocate the
I agree that we probably shouldn't send |
b9f26e7
to
9a45648
Compare
trying to wrap my head around not acquiring the when a bitcoind node opens a feeler connection, it acquires the grant in @jnewbery does that match your reasoning? |
Concept ACK |
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.
Was working on something similar.
I'm quite unsure as to why we are removing the limit of Feeler connections in the tests?
Having the limit as it is helps us as:
- We mimic the actual scenario where there's a limit to 1 outgoing Feeler connection at a time too
- Such checks prevent any sort of throttling that might happen in the future (even though its just on regtest for now)
- There's no such obstacle that the connection limit is obstructing us with
However, The test written for Feeler connections looks good to me (can be expanded further in the future to test full functionality of feelers).
ACK 9a45648 One thing I was thinking about is whether someone in the future would want to rely on fRelay=1 to distinguish whether a peer is tx-relaying or not (e.g. SPV-readonly), e.g. to populate addrman. |
Extend the addconnection RPC method to allow creating outbound feeler connections. Extend the test framework to accept those feeler connections.
…ions Add a test to verify that feeler connections do not request transaction relay.
9a45648
to
eaf6be0
Compare
Thanks for the reviews @amitiuttarwar @ShubhamPalriwala @naumenkogs
@amitiuttarwar - I don't understand this. In
@ShubhamPalriwala - I also don't understand this. There have never been any limits on the number of feelers, so this PR doesn't remove a limit. In normal operation, the number of feelers is implicitly limited because we'll only open them every 2 minutes on average, and the connections are short-lived. However, there's never been a hard limit on the number of feelers, and this PR doesn't propose to add one.
@naumenkogs - I think this is already impossible. Bitcoin Core will set fRelay=0 for block-relay-only connections. You can't interpret from fRelay=0 on a certain connection that the peer doesn't relay transactions at all, just that it doesn't want to receive transactions on this connection. |
ACK eaf6be0 |
@mzumsande @MarcoFalke mind taking another look at this one? Should be fairly straightforward. |
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.
review ACK eaf6be0 🏃
Show signature
Signature:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512
review ACK eaf6be0114a6d7763767da9496907fe8a670ff9e 🏃
-----BEGIN PGP SIGNATURE-----
iQGzBAEBCgAdFiEE+rVPoUahrI9sLGYTzit1aX5ppUgFAlwqrYAACgkQzit1aX5p
pUgyawv+I5/mXrAjLcYkne7KDbXAjbm/EtM/cX13nX96td7HK9PGpiEUaX/aMt6X
1Qsowv3dsv6UZVqJgvANWc1UZSvcOPyMHHGXy4tD3sTDjVA/iKD0CGZKUHDWBqAV
Ar+NJ20VK8bkyY4fF6zRqHE0bILiT0vWbkG88yF91gv8Hpz+Xc03MyGbqmg08CwU
LY+ul2MuioxuTz//NRoIBIO8HCTU2FSeP3ChZeRlcBuyPGCapYnYcesIFSHeM/+E
czZVpwB9UyGXjONXqFjhr8FMkRNDqV/2kmqVWewwQNzFTE3BpAE93JbSF/bZfLgT
Mh4dZ1NNPbaOVb569aE7UUcILhpbc+zGhUFFHHpJ6V+28UIc2zaJmAhKlxJ/WSSX
/yjNIS+4lxskLYgiQ+DQsIdXdz04QAbme4wA1It0cD5g+ope1/iuePgWm4uJ/8y8
fOb2uHr4bajys6x4hhi0kJhVnfS8f3euWLWVriZEj8/huq1B7CrSiErmN/I/IV6o
5+uSyAO7
=dERP
-----END PGP SIGNATURE-----
@@ -1096,7 +1096,7 @@ void PeerManagerImpl::PushNodeVersion(CNode& pnode, int64_t nTime) | |||
CService addr_you = addr.IsRoutable() && !IsProxy(addr) && addr.IsAddrV1Compatible() ? addr : CService(); | |||
uint64_t your_services{addr.nServices}; | |||
|
|||
const bool tx_relay = !m_ignore_incoming_txs && pnode.m_tx_relay != nullptr; | |||
const bool tx_relay = !m_ignore_incoming_txs && pnode.m_tx_relay != nullptr && !pnode.IsFeelerConn(); |
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.
style-nit for the future: const bool tx_relay{...};
.
…ions Summary: > [test] Add testing for outbound feeler connections > > Extend the addconnection RPC method to allow creating outbound > feeler connections. Extend the test framework to accept those > feeler connections. > [net processing] Do not request transaction relay from feeler connections > > Add a test to verify that feeler connections do not request transaction relay. This is a backport of [[bitcoin/bitcoin#22777 | core#22777]] Depends on D10944 Test Plan: `ninja all check-all` Reviewers: #bitcoin_abc, Fabien Reviewed By: #bitcoin_abc, Fabien Differential Revision: https://reviews.bitcoinabc.org/D10945
Feelers are short-lived connections used to test the viability of peers. The bitcoind node will periodically open feeler connections to addresses in its addrman, wait for a
version
message from the peer, and then close the connection.Currently, we set
fRelay
to1
in theversion
message for feeler connections, indicating that we want the peer to relay transactions to us. However, we close the connection immediately on receipt of theversion
message, and so never process any incoming transaction announcements. This PR changes that behaviour to instead setfRelay
to0
indicating that we do not wish to receive transaction announcements from the peer.This PR also extends the
addconnection
RPC to allow creating outbound feeler connections from the node to the test framework, and a test to verify that the node setsfRelay
to0
in theversion
message to feeler connections.