wallet: Avoid recursive lock in IsTrusted #19773

pull promag wants to merge 2 commits into bitcoin:master from promag:2020-08-wallet-istrusted changing 2 files +18 −17
  1. promag commented at 0:10 am on August 21, 2020: member

    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.

  2. promag force-pushed on Aug 21, 2020
  3. promag renamed this:
    2020 08 wallet istrusted
    wallet: Avoid recursive lock in IsTrusted
    on Aug 21, 2020
  4. fanquake added the label Wallet on Aug 21, 2020
  5. DrahtBot commented at 5:57 am on August 21, 2020: member

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

    Conflicts

    No conflicts as of last run.

  6. ryanofsky approved
  7. ryanofsky commented at 10:49 pm on August 24, 2020: member
    Code review ACK 0e71022306ca06f3f5df7b45a725a183b9409518. Looks good, thanks for following up on previous comments. Good to see this locking become more straightforward
  8. wallet, refactor: Immutable CWalletTx::pwallet 819f10f671
  9. wallet: Avoid recursive lock in IsTrusted 772ea4844c
  10. promag force-pushed on Aug 28, 2020
  11. promag commented at 9:42 am on August 28, 2020: member
    Rebased after #19289 merge.
  12. promag commented at 9:43 am on August 28, 2020: member
  13. meshcollider commented at 11:24 am on August 28, 2020: contributor
    utACK 772ea4844c34ad70d02fd0bd6c0945baa8fff85c
  14. hebasto commented at 7:59 am on August 30, 2020: member
    Concept ACK.
  15. in src/wallet/wallet.cpp:1975 in 772ea4844c
    1969@@ -1970,37 +1970,38 @@ bool CWalletTx::InMempool() const
    1970 
    1971 bool CWalletTx::IsTrusted() const
    1972 {
    1973-    std::set<uint256> s;
    1974-    return IsTrusted(s);
    1975+    std::set<uint256> trusted_parents;
    1976+    LOCK(pwallet->cs_wallet);
    1977+    return pwallet->IsTrusted(*this, trusted_parents);
    


    hebasto commented at 8:27 am on August 30, 2020:

    772ea4844c34ad70d02fd0bd6c0945baa8fff85c

    0    AssertLockNotHeld(pwallet->cs_wallet);
    1    std::set<uint256> trusted_parents;
    2    LOCK(pwallet->cs_wallet);
    3    return pwallet->IsTrusted(*this, trusted_parents);
    
  16. hebasto approved
  17. hebasto commented at 8:31 am on August 30, 2020: member
    ACK 772ea4844c34ad70d02fd0bd6c0945baa8fff85c, reviewed and tested on Linux Mint 20 (x86_64).
  18. meshcollider merged this on Aug 31, 2020
  19. meshcollider closed this on Aug 31, 2020

  20. sidhujag referenced this in commit f6b2c75b81 on Aug 31, 2020
  21. Fabcien referenced this in commit 819580a50c on Sep 14, 2021
  22. Fabcien referenced this in commit aca02ec56a on Sep 14, 2021
  23. DrahtBot locked this on Feb 15, 2022

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-10-05 01:12 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me