Skip to content

Conversation

maflcko
Copy link
Member

@maflcko maflcko commented May 17, 2022

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: Allow whitelisting outgoing connections #17167

@fanquake fanquake added the P2P label May 17, 2022
@maflcko maflcko changed the title Disconnect block-relay-only peers with relay permission when they fill tx announcements refactor: Introduce PeerManagerImpl::RejectIncomingTxs May 17, 2022
@maflcko maflcko force-pushed the 2205-block-relay-only-why-tx-inv- branch from fae8cc4 to fa20bae Compare May 17, 2022 15:14
@maflcko maflcko marked this pull request as draft May 17, 2022 15:19
@DrahtBot
Copy link
Contributor

DrahtBot commented May 18, 2022

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #25203 (logging: update to severity-based logging by jonatack)
  • #24170 (p2p, rpc: Manual block-relay-only connections with addnode by mzumsande)

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.

Copy link
Contributor

@ajtowns ajtowns left a comment

Choose a reason for hiding this comment

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

Concept ACK

@maflcko maflcko force-pushed the 2205-block-relay-only-why-tx-inv- branch from fa20bae to faefdbd Compare May 21, 2022 07:41
@maflcko maflcko marked this pull request as ready for review May 21, 2022 07:55
@maflcko maflcko requested a review from jnewbery May 21, 2022 15:48
Copy link
Contributor

@jnewbery jnewbery left a 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.

@maflcko maflcko force-pushed the 2205-block-relay-only-why-tx-inv- branch from faefdbd to fa2b5fe Compare May 27, 2022 13:29
@maflcko
Copy link
Member Author

maflcko commented May 27, 2022

Fixed feedback

@jnewbery
Copy link
Contributor

ACK fa2b5fe

Copy link
Contributor

@mzumsande mzumsande left a 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

@@ -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")
Copy link
Contributor

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.

Copy link
Member Author

Choose a reason for hiding this comment

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

Suggested change
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
@maflcko maflcko force-pushed the 2205-block-relay-only-why-tx-inv- branch from fa2b5fe to fafddaf Compare June 14, 2022 06:40
@maflcko
Copy link
Member Author

maflcko commented Jun 14, 2022

Fixed typo in test log. (Thanks Martin!)

Should be trivial to re-ACK with git range-diff bitcoin-core/master fa2b5fe0c1 fafddafc2c.

@jnewbery
Copy link
Contributor

Code review ACK fafddaf

Copy link
Contributor

@mzumsande mzumsande left a 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):
Copy link
Contributor

@mzumsande mzumsande Jun 15, 2022

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.

@maflcko maflcko merged commit ede9089 into bitcoin:master Jun 15, 2022
@maflcko maflcko deleted the 2205-block-relay-only-why-tx-inv-🤗 branch June 15, 2022 06:17
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Jun 15, 2022
…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
@bitcoin bitcoin locked and limited conversation to collaborators Jun 15, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants