Skip to content

Conversation

@promag
Copy link
Contributor

@promag promag commented Aug 21, 2020

This change moves CWalletTx::IsTrusted to CWallet in order to have TSAN. So now CWallet::IsTrusted requires cs_wallet and the recursive lock no longer happens.

Motivated by https://github.com/bitcoin/bitcoin/pull/19289/files#r473308226.

@promag promag force-pushed the 2020-08-wallet-istrusted branch from cd9bb59 to 0e71022 Compare August 21, 2020 00:11
@promag promag changed the title 2020 08 wallet istrusted wallet: Avoid recursive lock in IsTrusted Aug 21, 2020
@DrahtBot
Copy link
Contributor

DrahtBot commented Aug 21, 2020

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

Conflicts

No conflicts as of last run.

Copy link
Contributor

@ryanofsky ryanofsky 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 0e71022306ca06f3f5df7b45a725a183b9409518. Looks good, thanks for following up on previous comments. Good to see this locking become more straightforward

@promag promag force-pushed the 2020-08-wallet-istrusted branch from 0e71022 to 772ea48 Compare August 28, 2020 09:42
@promag
Copy link
Contributor Author

promag commented Aug 28, 2020

Rebased after #19289 merge.

@promag
Copy link
Contributor Author

promag commented Aug 28, 2020

@meshcollider

Copy link
Contributor

@meshcollider meshcollider left a comment

Choose a reason for hiding this comment

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

utACK 772ea48

@hebasto
Copy link
Member

hebasto commented Aug 30, 2020

Concept ACK.

Copy link
Member

@hebasto hebasto left a comment

Choose a reason for hiding this comment

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

ACK 772ea48, reviewed and tested on Linux Mint 20 (x86_64).

Comment on lines +1973 to +1975
std::set<uint256> trusted_parents;
LOCK(pwallet->cs_wallet);
return pwallet->IsTrusted(*this, trusted_parents);
Copy link
Member

Choose a reason for hiding this comment

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

772ea48

Suggested change
std::set<uint256> trusted_parents;
LOCK(pwallet->cs_wallet);
return pwallet->IsTrusted(*this, trusted_parents);
AssertLockNotHeld(pwallet->cs_wallet);
std::set<uint256> trusted_parents;
LOCK(pwallet->cs_wallet);
return pwallet->IsTrusted(*this, trusted_parents);

@meshcollider meshcollider merged commit 7721b31 into bitcoin:master Aug 31, 2020
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Aug 31, 2020
772ea48 wallet: Avoid recursive lock in IsTrusted (João Barbosa)
819f10f wallet, refactor: Immutable CWalletTx::pwallet (João Barbosa)

Pull request description:

  This change moves `CWalletTx::IsTrusted` to `CWallet` in order to have TSAN. So now `CWallet::IsTrusted` requires `cs_wallet` and the recursive lock no longer happens.

  Motivated by https://github.com/bitcoin/bitcoin/pull/19289/files#r473308226.

ACKs for top commit:
  meshcollider:
    utACK 772ea48
  hebasto:
    ACK 772ea48, reviewed and tested on Linux Mint 20 (x86_64).

Tree-SHA512: 702ffd928b2f42a8b90de398790649a5fd04e1ac3877558da928e94cdeb19134883f06c3a73a6826c11c912facf199173375a70200737e164ccaea1bec515b2a
Fabcien pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this pull request Sep 14, 2021
Summary:
PR description:
> This change moves `CWalletTx::IsTrusted` to `CWallet` in order to have TSAN. So now `CWallet::IsTrusted` requires `cs_wallet` and the recursive lock no longer happens.

This is a backport of [[bitcoin/bitcoin#19773 | core#19773]] [1/2]
bitcoin/bitcoin@819f10f

Depends on D10097

Test Plan:
With TSAN:
`ninja all check-all`

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Differential Revision: https://reviews.bitcoinabc.org/D10099
Fabcien pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this pull request Sep 14, 2021
Summary:
This is a backport of [[bitcoin/bitcoin#19773 | core#19773]] [2/2]
bitcoin/bitcoin@772ea48

Backport note: `checkFinalTx` was replaced by `ContextualCheckTransactionForCurrentBlock`  in D5804

Test Plan:
With TSAN:
`ninja all check-all`

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Differential Revision: https://reviews.bitcoinabc.org/D10100
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Feb 15, 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