-
Notifications
You must be signed in to change notification settings - Fork 37.7k
net processing: Don't require locking cs_main before calling RelayTransactions() #21845
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
unsigned cr ACK 9012512 |
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.
Code review ACK 9012512.
Callers of the external RelayTransactions() no longer need to lock cs_main.
9012512
to
39e1971
Compare
Thanks for the review @promag. I've addressed your review comments. |
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 39e1971, just included sync.h since last review.
re-unsigned-code-review ACK 39e1971 |
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 39e1971
please also help to review the conflicting pull requests
Hi, fellow reviewers of this PR...
@@ -1511,6 +1515,11 @@ void PeerManagerImpl::SendPings() | |||
} | |||
|
|||
void PeerManagerImpl::RelayTransaction(const uint256& txid, const uint256& wtxid) | |||
{ | |||
WITH_LOCK(cs_main, _RelayTransaction(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.
No need for ;);
-- there's already a terminating ;
in the WITH_LOCK
#define
. Could just use a plain LOCK
instead of WITH_LOCK
too...
…fore calling RelayTransactions() 39e1971 [net processing] Add internal _RelayTransactions() (John Newbery) Pull request description: As part of the general effort to reduce cs_main usage in net_processing, this removes the need to be holding `cs_main` when calling `RelayTransactions()` from outside net_processing. Internally, we lock `cs_main` and call an internal `_RelayTransactions()` function that _does_ require `cs_main`. ACKs for top commit: MarcoFalke: re-unsigned-code-review ACK 39e1971 promag: Code review ACK 39e1971, just included sync.h since last review. ajtowns: ACK 39e1971 Tree-SHA512: dc08441233adfb8eaac501cf497cb4bad029eb723bd3fa8a3d8b7e49cc984c98859b95780ad15f5701d62ac745a8223beb0df405e3d49d95a8c86c8be17c9543
As part of the general effort to reduce cs_main usage in net_processing, this removes the need to be holding
cs_main
when callingRelayTransactions()
from outside net_processing. Internally, we lockcs_main
and call an internal_RelayTransactions()
function that does requirecs_main
.