-
Notifications
You must be signed in to change notification settings - Fork 38.7k
net_processing: rename RelayTransaction to better describe what it does #33565
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
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. Code Coverage & BenchmarksFor details see: https://corecheck.dev/bitcoin/bitcoin/pulls/33565. ReviewsSee the guideline for information on the review process.
If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update. 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. |
|
ACK 44a726133a880f818228c01b55236b3cb3eb1a67 Straightforward renaming of one method, plus doc comment change. |
stratospher
left a comment
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 44a7261.
cedwies
left a comment
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.
Tested ACK 44a7261
Unit/Functional tests pass.
Checked git grep RelayTransaction
|
ACK 44a726133a880f818228c01b55236b3cb3eb1a67 |
44a7261 to
84b2ad0
Compare
|
|
|
utACK 84b2ad0334 |
andrewtoth
left a comment
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 84b2ad03349bf6af3d6057f3dbcdf84c17f11bcb
l0rinc
left a comment
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.
Left a few code comment suggestions, I think the newly added one is a bit imprecise, but I also don't mind merging as is if others don't think they're serious.
ACK 84b2ad03349bf6af3d6057f3dbcdf84c17f11bcb
|
reACK 84b2ad03349bf6af3d6057f3dbcdf84c17f11bcb |
cedwies
left a comment
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 84b2ad0
naiyoma
left a comment
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 84b2ad03349bf6af3d6057f3dbcdf84c17f11bcb
|
I don't think it makes much sense to split this out; it doesn't reduce the size of the parent PR meaningfully, and renaming a function doesn't really seem like it justifies a PR on its own. |
84b2ad0 to
9989853
Compare
|
I agree it does not help much. It helps a little. And that is the point - to get some smaller changes out of the main PR.
Having this in its own PR helped have a fresh discussion that resulted in picking up a better name. This did not happen in the main PR for ~1.5 years. That is a positive outcome from having a PR on its own.
For me |
|
I also prefer extracting these smaller changes from big PR to smaller, dedicated ones to have some progress and to have focused discussions |
w0xlt
left a comment
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.
crACK 9989853
To be explicit: NACK. Reviewing bitcoin PRs well is hard, we should not be increasing that burden for, at best, marginal benefits to the author of the PR. For this particular PR, bikeshedding about the names of functions is not a good use of anyone's time here. Further, small PRs that seem to just be a mild refactoring with no (expected) functional effect have repeatedly resulted in meaningful changes; ones that come to mind currently include:
To me, the lesson from examples like that is that all our PRs, even the ones that seem like they should be trivial, should receive serious, in-depth review. But we're already constrained on review, and should therefore be prioritising what review resources we have to the most valuable PRs we have, not the easiest ones. This PR in particular, and the strategy of "let's split off easy commits into separate PRs" more generally, does the opposite. Worse, if we do make a habit of merging PRs that (a) seem trivial, and (b) have cursory review from a couple of possibly newer contributors because there's not enough benefit to justify deeper review, and no apparent need for it; then that opens up a relatively straightforward way to introduce severe bugs (or one that's at least as straightforward as our approach to fixing severe bugs). Far better to focus on PRs that make non-trivial improvements, and apply correspondingly non-trivial levels of review before merging. |
…does Rename `PeerManager::RelayTransaction()` to `PeerManager::InitiateTxBroadcastToAll()`. The transaction is not relayed when the method returns. It is only enqueued for a possible broadcasting at a later time. Also, there will be another method which only does so to Tor or I2P peers.
9989853 to
78595ae
Compare
|
|
l0rinc
left a comment
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 don't want to be dismissive of @ajtowns' claims. I agree they're all valid, and please allow me to push back respectfully.
bikeshedding about the names of functions is not a good use of anyone's time here.
I've been tricked many times by misnamed methods. If you think the old name is good, or the new name is worse, or the new comment isn't adding anything, I can empathize with that. But nobody is forcing us to review this. I personally do it because I want some progress with the original, and I know how difficult it is when a sub-change that everyone agrees on keeps getting rebased for months or years without any progress. If people decided that this change is a good use of their time, I don't think it's fair to deny them that.
refactoring with no (expected) functional effect have repeatedly resulted in meaningful changes
Most of our work is refactoring. Changing a method's name to better reflect its usage fits very well into that picture, in my opinion. Again, if you don't agree that the new name is better, that's fair, but I don't see how this refactor differs from the hundreds of others we do regularly.
Far better to focus on PRs that make non-trivial improvements, and apply correspondingly non-trivial levels of review before merging.
I'm not sure I follow. How is this different from extracting changes into commits to separate noise from signal and to allow proportional review time to the risk implied? How is this different from, e.g., #33862, which also extracts a small change from the big one to unburden it and make some progress?
Let the record show that I'm personally fine with this change:
ACK 78595ae, redid the change locally, verified the flow and the comment seems to describe what's happening accurately.
| break; | ||
| case TxBroadcast::MEMPOOL_AND_BROADCAST_TO_ALL: | ||
| node.peerman->RelayTransaction(txid, wtxid); | ||
| node.peerman->InitiateTxBroadcastToAll(txid, wtxid); |
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.
the enum name aligns more closely with the method name now 👍
w0xlt
left a comment
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.
reACK 78595ae
I get your points, however, to nuance it a bit:
Pros:
A minor change like this in itself is a no-go. As part of a larger (exisitng) PR is possible. In this particular case I lean towards go, though not strongly. |
|
reACK 78595ae |
|
I agree with @ajtowns and don't entirely see the benefit of having split this commit into its own PR. As someone who frequently writes gigantic PRs that need to be split up, this commit for me would not have met the bar to be split into its own PR. It isn't a complicated refactor that needs focused review on its own; it isn't something that is useful across multiple PRs; and it isn't itself a feature that is useful on its own. I get that having smaller PRs can make it feel like things are moving faster for a project, but it also means that there is an intermediate state where we will have merged a bunch of prep work but not the feature itself. In that past this has led to both unnecessary code churn (a refactor was done for a feature, but then it gets refactored again before the feature is completed, so yet another refactor needs to be done), technical debt, and unfinished features.
We rarely do PRs that are just renaming things. IIRC renaming PRs are generally limited to things that are particularly misleading and actively causing confusion.
That change is made independent of the main PR, and in fact, the main PR does not even include the commit at all. The small change could simply never be merged and it would have no effect on the big change. In contrast, the commit in this PR is included in #29415 and is a currently a prerequisite for that PR to be merged. |
|
Thanks for the explanation @achow101!
I assumed that was the case here - if not, maybe the parent PR could also just avoid the rename in the first place.
Valid points, I also don't like that the same code is now reviewed in a lot of places. The PR is in review for 2.5 years, what is the best way forward, how can we make progress there?
|
|
This is going to get merged via #29415, which at this point, is getting ACKs. |

Rename
PeerManager::RelayTransaction()toPeerManager::InitiateTxBroadcastToAll(). The transaction is not relayed when the method returns. It is only scheduled for broadcasting at a later time. Also, there will be another method which only schedules for broadcast to Tor or I2P peers.This is part of #29415 Broadcast own transactions only via short-lived Tor or I2P connections. Putting it in its own PR to reduce the size of #29415 and because it does not depend on the other commits from there.