-
Notifications
You must be signed in to change notification settings - Fork 37.7k
p2p: don't add AlreadyHave transactions to recentRejects #19753
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
p2p: don't add AlreadyHave transactions to recentRejects #19753
Conversation
Concept ACK Looks like the https://travis-ci.org/github/bitcoin/bitcoin/jobs/718732253#L3341 |
strong concept ACK! nice find :) |
Concept ACK |
8d90d0f
to
9325a06
Compare
Fixed the broken test |
9325a06
to
95134c8
Compare
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.
utACK. One suggested change to the test.
@@ -146,7 +146,7 @@ def check_tx_relay(self): | |||
[tx], | |||
self.nodes[1], | |||
success=False, | |||
reject_reason='Not relaying non-mempool transaction {} from forcerelay peer=0'.format(txid), | |||
reject_reason='{} from peer=0 was not accepted: txn-mempool-conflict'.format(txid) |
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.
I think to fully test that sending an invalid transaction from a forcerelay peer doesn't result in the tx being relayed, you'd need to add:
+ p2p_rebroadcast_wallet.send_txs_and_test(
+ [tx],
+ self.nodes[1],
+ success=False,
+ reject_reason='Not relaying non-mempool transaction {} from forcerelay peer=0'.format(txid)
+ )
+
The first time the transaction is sent, it's rejected and not added to the mempool, but is added to recentRejects. The second time the transaction is sent, we AlreadyHave it and choose not to relay it because it's not in the mempool.
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.
thanks, fixed
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.
You should also add a comment here to explain why you're sending the transaction twice.
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. |
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.
Not sure if this is the right approach. One could also argue that all txs accepted to the mempool should be added to recentRejects, so that prior versions of rbfed txs will be rejected right away without going through another costly ATMP round. No strong opinion though.
No. That's completely changing the meaning of recentRejects. |
|
95134c8
to
47132bb
Compare
I'll leave any idea changes to recentRejects for a follow-up. |
47132bb
to
68bb294
Compare
|
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.
I wanted to point out the slight behaviour change with regard to rbf'ed txs, but that doesn't seem to open any issues.
Approach ACK
anyone track this regression's origin? 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.
utACK 68bb294
One request for better commenting. Not essential.
@@ -146,7 +146,7 @@ def check_tx_relay(self): | |||
[tx], | |||
self.nodes[1], | |||
success=False, | |||
reject_reason='Not relaying non-mempool transaction {} from forcerelay peer=0'.format(txid), | |||
reject_reason='{} from peer=0 was not accepted: txn-mempool-conflict'.format(txid) |
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.
You should also add a comment here to explain why you're sending the transaction twice.
68bb294
to
39b2418
Compare
d7aa195
to
77ebed1
Compare
9bcdd34
to
f996019
Compare
Trivial rebase |
Now, we only add a transaction to our recentRejects filter if we didn't already have it, meaning that it is added at most once, as intended.
f996019
to
d419fde
Compare
PR Status: Ready For Review Should be quick for anyone interested 😄 |
Code review ACK d419fde |
Concept ACK |
Code review ACK d419fde |
…tRejects d419fde [net processing] Don't add AlreadyHave txs to recentRejects (Troy Giorshev) Pull request description: If we already have a transaction, don't add it to recentRejects Now, we only add a transaction to our recentRejects filter if we didn't already have it, meaning that it is added at most once, as intended. ACKs for top commit: jnewbery: Code review ACK d419fde laanwj: Code review ACK d419fde Tree-SHA512: cff5c1ba36c4700e2d6ab3eec4a3e51e1bef28fb3cc1bc850c84e06d6e5a9f6c32825207c253cc9cdf596b2eaadb6b5be68b3f8ca752b4ef6c31cf85138e3c99
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.
Posthumous ACK d419fde
Summary: Now, we only add a transaction to our recentRejects filter if we didn't already have it, meaning that it is added at most once, as intended. This is a backport of [[bitcoin/bitcoin#19753 | core#19753]] Test Plan: `ninja all check-all` Reviewers: #bitcoin_abc, Fabien Reviewed By: #bitcoin_abc, Fabien Differential Revision: https://reviews.bitcoinabc.org/D10681
If we already have a transaction, don't add it to recentRejects
Now, we only add a transaction to our recentRejects filter if we didn't already have it, meaning that it is added at most once, as intended.