-
Notifications
You must be signed in to change notification settings - Fork 37.7k
Continue relaying transactions after they expire from mapRelay #16851
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
This is particularly useful with support for package relay, see #16401. It would be possible to go a bit further and drop mapRelay entirely; but we want to delay relaying transactions until we've inv'ed them, and currently we use mapRelay for that logic -- ie, we receive a tx, add it to setInventoryTxToSend, wait for a random poisson delay, INV the tx to a peer, add it to mapRelay, and only then are we willing to relay the tx. The poisson delay maxes out at about 3 minutes, so any tx that's been around for <15m is either to new to relay, or is already in mapRelay. Ideally we would have some per-peer logic so that we only relay new txs to peer X if we've INV'ed the tx to peer X; but saving that work for a different PR in order to keep this one simple. |
Code review ACK, will test. I believe this will be useful even without package relay -- whenever a node starts up with an empty (or stale) mempool, transactions with parents fail to make it into the mempool because our peers won't serve parents that were previously relayed. But I would also like this bug to be fixed as soon as possible, so that a package-acceptance scheme like what I'm proposing in #16401 is immediately useful, even before proposing a p2p protocol extension for package relay. |
ACK 7b2dbf9 I ran a new node connected only to a node running this patch, and observed that as transaction relay started (after IBD) that the node started receiving orphan transactions that were then accepted to the mempool after the parents were fetched. |
Concept ACK I don't think so, but asking for sake of completeness: this will not affect privacy (fingerprinting) negatively, will it? |
I don't think so; I think you can already tell if tx "X" is in a peer's mempool by constructing a tx with "X:0" and "Y:0" as inputs (Y being a non-existent txid, providing invalid sigs for both, relies on X being rbf'able or X:0 not being spent yet), and see if they request both X and Y or just Y. |
I agree with @ajtowns that this shouldn't add any additional privacy leak, because it's already possible to test the presence of a transaction in the mempool.
Edit: on further thought, I think this concern is basically misplaced. The mempool command is not rate-limited by poisson timers (just the initial response is delayed once), and at any rate there are trivial ways to use bandwidth that are not exacerbated by this change. |
Concept ACK. |
This missed the deadline for 0.19, so maybe it should be removed from high prio and targeted for 0.20? |
Concept ACK. I've written #16908, so that those ugly multiplications by Will take a closer look some time later. |
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. |
Needs rebase 👀 |
7b2dbf9
to
aaca5d9
Compare
code review ACK aaca5d9 I think this is a good candidate for early merge for 0.20 (to be able to notice issues with this change in behavior far before a relase). |
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.
ACK aaca5d9
Show signature and timestamp
Signature:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512
ACK aaca5d90c0859ea3883f71aa7bc7e30cfab87a21
-----BEGIN PGP SIGNATURE-----
iQGzBAEBCgAdFiEE+rVPoUahrI9sLGYTzit1aX5ppUgFAlwqrYAACgkQzit1aX5p
pUinowv/ZU/xg+wTAlCYcpsbJLqeOJNvWWg5fiHNZvsGkcfX4/2GlD2FAELSICvm
PI7DlGDGzayY5tH6ceIWmqB5w5j2wmxQtuz3cKcIz8wkJQn+pOLxn3k4WKU7zlxR
SsJ5VZBMCnFOQQ+Pi6OVtnfrXYXbqxVzlDhjeoYBrkoMCjK92e/q3RrV4BwvsAGd
PM90Sej8UbYuFk6V3GrUQruIh1d6yIpuDWrY0+NWWuMwdK/5H4xqpq37+YknzgMi
BhAR9tg1XSxqyDtZworytY4zzPOQS7BG4foEyoM8Kb4zjEqYQ/oyWSoq2Xs/Wxm4
H7nAA3y2WdtuE5RCt7lpipi9vGmBj9DEr5abx1ZLUKugdUDy9lfbIM/oG+zylKXF
49F0RQRxsGH8A0JQYq6GzJOUYxp1+35ttVahEwGvWhiXG7AGRLYo1PcTwmkPbzS4
z2oJD5NtYQnKN37j9V24uaGAoh7AXn7FAxp9oakeZe9X9f6iwIoR4wElwIqvG96q
mkW7StXQ
=fRMY
-----END PGP SIGNATURE-----
Timestamp of file with hash 0970ab24f6dc0609f52b54188404a5e069b6a5372f89722e14db5cba3ea2a7fe -
@ajtowns 🙏 ^ |
aaca5d9
to
168b781
Compare
re-ACK 168b781 (only change is comment fixup) Show signature and timestampSignature:
Timestamp of file with hash |
I'm not sure if we should just give up on trying to prevent testing the contents of our mempool? |
Long term it probably make sense to give up on it. Though, as long as the default wallet behaviour is to put the txs in the mempool immediately, we should keep the privacy effect of mapRelay. |
This change has no adverse effect on privacy unless I am mistaken. It is a nice tx relay improvement. |
I deleted my earlier comment, as I realized I missed the distinction between what this PR does (making txn available after expiry) and the idea of dropping mapRelay entirely (making everything always available). I was confused by the "this is not a privacy leak because mempool presence can be tested in different ways" response; while that's true, it's also not a privacy leak even if there were no other ways to test for memool presence. |
re-ACK 168b781 |
ACK 168b781 |
…apRelay 168b781 Continue relaying transactions after they expire from mapRelay (Anthony Towns) Pull request description: This change allows peers to request transactions even after they've expired from mapRelay and even if they're not doing mempool requests. This is intended to allow for CPFP of old transactions -- if parent tx P wasn't relayed due to low fees, then a higher fee rate child C is relayed, peers will currently request the parent P, but we prior to this patch, we will not relay it due to it not being in mapRelay. ACKs for top commit: MarcoFalke: re-ACK 168b781 (only change is comment fixup) sdaftuar: re-ACK 168b781 sipa: ACK 168b781 Tree-SHA512: b206666dd1450cd0a161ae55fd1a7eda2c3d226842ba27d91fe463b551fd924b65b92551b14d6786692e15cf9a9a989666550dfc980b48ab0f8d4ca305bc7762
Summary: This is a backport of Core [[bitcoin/bitcoin#16851 | PR16851]] Test Plan: ninja all check-all Reviewers: #bitcoin_abc, Fabien Reviewed By: #bitcoin_abc, Fabien Differential Revision: https://reviews.bitcoinabc.org/D6563
This change allows peers to request transactions even after they've expired from mapRelay and even if they're not doing mempool requests. This is intended to allow for CPFP of old transactions -- if parent tx P wasn't relayed due to low fees, then a higher fee rate child C is relayed, peers will currently request the parent P, but we prior to this patch, we will not relay it due to it not being in mapRelay.