-
Notifications
You must be signed in to change notification settings - Fork 37.7k
refactor: Introduce PeerManagerImpl::RejectIncomingTxs #25156
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: Introduce PeerManagerImpl::RejectIncomingTxs #25156
The head ref may contain hidden characters: "2205-block-relay-only-why-tx-inv-\u{1F917}"
Conversation
fae8cc4
to
fa20bae
Compare
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.
Concept ACK
fa20bae
to
faefdbd
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.
Concept ACK
Can you copy the rationale to the commit log? It currently doesn't explain why you're introducing the new RejectIncomingTxs() function. I'd also suggest dropping the "refactor" tag.
faefdbd
to
fa2b5fe
Compare
Fixed feedback |
ACK fa2b5fe |
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.
Code Review ACK fa2b5fe
test/functional/p2p_blocksonly.py
Outdated
@@ -89,6 +89,11 @@ def blocks_relay_conn_tests(self): | |||
assert_equal(self.nodes[0].getpeerinfo()[0]['relaytxes'], False) | |||
_, txid, _, tx_hex = self.check_p2p_tx_violation() | |||
|
|||
self.log.info("Tests with node in normal mode with block-relay-only connections with relay permission") |
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.
"with relay permission":
I think that even if block-relay-only connections could have relay permission, they still wouldn't have that here because the last restart disabling -blocksonly
mode cleared the -whitelist=relay@127.0.0.1
arg from above.
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.
self.log.info("Tests with node in normal mode with block-relay-only connections with relay permission") | |
self.log.info("Tests with node in normal mode with block-relay-only connection, sending an inv") |
Oh good catch. I changed the test to an inv
once I realized that permission flags can't be set, but forgot to update the comment.
Currently there are some confusions in net_processing: * There is confusion between `-blocksonly mode` and `block-relay-only`, so adjust all comments to use the same nomenclature. * Whether to disconnect peers for providing invs/txs is implemented differently. For example, it seems a bit confusing to disconnect `block-relay-only` peers with `relay` permission when they send a tx message, but not when they send an inv message. Also, keeping track of their inv announcements seems both wasteful and confusing, as it does nothing. This isn't possible in practice, as outbound connections do not have permissions assigned, but sees fragile to rely on. Especially in light of proposed changes to make that possible: bitcoin#17167
fa2b5fe
to
fafddaf
Compare
Fixed typo in test log. (Thanks Martin!) Should be trivial to re-ACK with |
Code review ACK fafddaf |
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 fafddaf
@@ -100,6 +105,13 @@ def blocks_relay_conn_tests(self): | |||
conn.sync_send_with_ping() | |||
assert(int(txid, 16) not in conn.get_invs()) | |||
|
|||
def check_p2p_inv_violation(self, peer): |
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.
This doesn't need to be done here, but if there is a new function for this anyway, it could also be used in the first part blocksonly_mode_tests
to remove some (almost) duplicate code.
…ingTxs fafddaf refactor: Introduce PeerManagerImpl::RejectIncomingTxs (MacroFake) Pull request description: Currently there are some confusions in net_processing: * There is confusion between `-blocksonly mode` and `block-relay-only`, so adjust all comments to use the same nomenclature. * Whether to disconnect peers for providing invs/txs is implemented differently. For example, it seems a bit confusing to disconnect `block-relay-only` peers with `relay` permission when they send a tx message, but not when they send an inv message. Also, keeping track of their inv announcements seems both wasteful and confusing, as it does nothing. This isn't possible in practice, as outbound connections do not have permissions assigned, but sees fragile to rely on. Especially in light of proposed changes to make that possible: bitcoin#17167 ACKs for top commit: MarcoFalke: Should be trivial to re-ACK with `git range-diff bitcoin-core/master fa2b5fe fafddaf`. jnewbery: Code review ACK fafddaf mzumsande: ACK fafddaf Tree-SHA512: 73bf91afe93be619169cfbf3bf80cb08a5e6f73df4e0318b86817bd4d45f67408ea85998855992281d2decc9d24f7d75cffb83a0518d670090907309df8a3490
Currently there are some confusions in net_processing:
-blocksonly mode
andblock-relay-only
, so adjust all comments to use the same nomenclature.block-relay-only
peers withrelay
permission when they send a tx message, but not when they send an inv message. Also, keeping track of their inv announcements seems both wasteful and confusing, as it does nothing. This isn't possible in practice, as outbound connections do not have permissions assigned, but sees fragile to rely on. Especially in light of proposed changes to make that possible: Allow whitelisting outgoing connections #17167