Skip to content

Conversation

jnewbery
Copy link
Contributor

@jnewbery jnewbery commented May 3, 2021

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.

@maflcko
Copy link
Member

maflcko commented May 3, 2021

unsigned cr ACK 9012512

@DrahtBot DrahtBot added the P2P label May 3, 2021
@DrahtBot
Copy link
Contributor

DrahtBot commented May 4, 2021

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

Conflicts

Reviewers, 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.

Copy link
Contributor

@promag promag 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 9012512.

Callers of the external RelayTransactions() no longer need to lock cs_main.
@jnewbery jnewbery force-pushed the 2021-05-internal_relay_txs branch from 9012512 to 39e1971 Compare May 4, 2021 08:31
@jnewbery
Copy link
Contributor Author

jnewbery commented May 4, 2021

Thanks for the review @promag. I've addressed your review comments.

Copy link
Contributor

@promag promag 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 39e1971, just included sync.h since last review.

@maflcko
Copy link
Member

maflcko commented May 4, 2021

re-unsigned-code-review ACK 39e1971

@fanquake fanquake requested review from amitiuttarwar and ajtowns May 6, 2021 10:58
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.

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

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...

@fanquake fanquake merged commit a0d1d48 into bitcoin:master May 7, 2021
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request May 7, 2021
…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
@jnewbery jnewbery deleted the 2021-05-internal_relay_txs branch May 7, 2021 08:02
gwillen pushed a commit to ElementsProject/elements that referenced this pull request Jun 1, 2022
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Aug 16, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants