Add AssertLockHeld assertions in CWallet::ListCoins #10605

pull ryanofsky wants to merge 2 commits into bitcoin:master from ryanofsky:pr/listlock changing 3 files +16 −14
  1. ryanofsky commented at 7:44 pm on June 15, 2017: member
    Fixes TODO from #10295
  2. fanquake added the label Wallet on Jun 16, 2017
  3. sipa commented at 9:59 pm on June 16, 2017: member
    utACK 5c7a7de7b38a84a3ba1e6c26dd1af67236dad891
  4. laanwj renamed this:
    Add AssertLockHeld assertions in CWallet::ListCoins
    [dotnotmerge] Add AssertLockHeld assertions in CWallet::ListCoins
    on Jun 24, 2017
  5. ryanofsky force-pushed on Aug 29, 2017
  6. ryanofsky force-pushed on Aug 29, 2017
  7. ryanofsky force-pushed on Feb 9, 2018
  8. ryanofsky force-pushed on Apr 6, 2018
  9. ryanofsky renamed this:
    [dotnotmerge] Add AssertLockHeld assertions in CWallet::ListCoins
    Add AssertLockHeld assertions in CWallet::ListCoins
    on Apr 6, 2018
  10. ryanofsky commented at 5:58 pm on April 6, 2018: member

    Be careful here: this is dependent on a PR that has not been merged yet. Do not merge.

    Dependent PR #10244 got merged, so this is now safe to merge too.


    Rebased 5c7a7de7b38a84a3ba1e6c26dd1af67236dad891 -> 8392051595c615216f3857d54a80cf708ed1f29e (pr/listlock.1 -> pr/listlock.2) due to conflict with #11126 Rebased 8392051595c615216f3857d54a80cf708ed1f29e -> cc69e88921725bed4b1e11823914aa8e418b7220 (pr/listlock.2 -> pr/listlock.3) Rebased cc69e88921725bed4b1e11823914aa8e418b7220 -> a6c634013b7cf5d74bea68e51c011effcd7fc11d (pr/listlock.3 -> pr/listlock.4) due to conflicts with #10295 and #12333 Rebased a6c634013b7cf5d74bea68e51c011effcd7fc11d -> 8740c61a334b3774984cfd1a3d67e33e68adb96a (pr/listlock.4 -> pr/listlock.5)

  11. promag commented at 9:19 pm on April 6, 2018: member
    utACK 8740c61.
  12. Add AssertLockHeld assertions in CWallet::ListCoins 545e85eccc
  13. ryanofsky force-pushed on Apr 11, 2018
  14. ryanofsky commented at 3:45 pm on April 11, 2018: member
    Rebased 8740c61a334b3774984cfd1a3d67e33e68adb96a -> 545e85eccc2441c6d7745bb90d88dc14718455a2 (pr/listlock.5 -> pr/listlock.6) due to conflict with #12920
  15. MarcoFalke commented at 8:21 pm on April 27, 2018: member
    Would you mind adding the clang lock annotations here as well?
  16. DrahtBot closed this on Jul 21, 2018

  17. DrahtBot commented at 5:29 pm on July 21, 2018: member
  18. DrahtBot reopened this on Jul 21, 2018

  19. MarcoFalke commented at 5:51 pm on July 21, 2018: member
    @ryanofsky Are you still working on this? If so, mind to respond to my previous question from April?
  20. MarcoFalke commented at 1:16 am on July 22, 2018: member

    Missing locking annotations:

    0wallet/wallet.cpp:2362:5: error: calling function 'AvailableCoins' requires holding mutex 'cs_wallet' exclusively [-Werror,-Wthread-safety-analysis]
    1    AvailableCoins(availableCoins);
    2    ^
    3wallet/wallet.cpp:2373:5: error: calling function 'ListLockedCoins' requires holding mutex 'cs_wallet' exclusively [-Werror,-Wthread-safety-analysis]
    4    ListLockedCoins(lockedCoins);
    5    ^
    
  21. laanwj commented at 10:38 am on August 31, 2018: member
    Closing as this seems to be inactive, let me know if you start work on this again and I should reopen it.
  22. laanwj closed this on Aug 31, 2018

  23. laanwj added the label Up for grabs on Aug 31, 2018
  24. ryanofsky commented at 11:53 am on August 31, 2018: member

    Closing as this seems to be inactive, let me know if you start work on this again and I should reopen it.

    This PR can be reopened. There isn’t actually any work that needs to be done here since the clang errors @MarcoFalke reported were fixed by @skeees in #13423 (f393a533bebc088985f94c725b9af881500ba998).

  25. MarcoFalke reopened this on Aug 31, 2018

  26. MarcoFalke removed the label Up for grabs on Aug 31, 2018
  27. MarcoFalke commented at 12:04 pm on August 31, 2018: member

    @ryanofsky What I mean with locking annotations is the clang-annotations in the header file:

     0diff --git a/src/wallet/wallet.h b/src/wallet/wallet.h
     1index 05ae9a1bbf..da326517c0 100644
     2--- a/src/wallet/wallet.h
     3+++ b/src/wallet/wallet.h
     4@@ -764,7 +764,7 @@ public:
     5     /**
     6      * Return list of available coins and locked coins grouped by non-change output address.
     7      */
     8-    std::map<CTxDestination, std::vector<COutput>> ListCoins() const;
     9+    std::map<CTxDestination, std::vector<COutput>> ListCoins() const EXCLUSIVE_LOCKS_REQUIRED(cs_main, cs_wallet);
    10 
    11     /**
    12      * Find non-change parent output.
    

    Without these, it is only a best-guess runtime-check that the correct locks are taken for this method.

  28. Add EXCLUSIVE_LOCKS_REQUIRED to CWallet::ListCoins
    Suggested by MarcoFalke <falke.marco@gmail.com> in
    https://github.com/bitcoin/bitcoin/pull/10605#issuecomment-417643535
    62b6f0f21e
  29. MarcoFalke commented at 12:13 pm on August 31, 2018: member
    utACK 545e85eccc2441c6d7745bb90d88dc14718455a2 (given that the clang lock annotations are included in this commit)
  30. MarcoFalke commented at 12:25 pm on August 31, 2018: member
    utACK 62b6f0f21e24ff367d096c80ebdf398de4a98163
  31. promag commented at 12:46 pm on August 31, 2018: member
    utACK 62b6f0f.
  32. MarcoFalke merged this on Aug 31, 2018
  33. MarcoFalke closed this on Aug 31, 2018

  34. MarcoFalke referenced this in commit b012bbe358 on Aug 31, 2018
  35. Bushstar referenced this in commit 3102eba576 on Sep 4, 2018
  36. jfhk referenced this in commit e66674943d on Nov 14, 2018
  37. HashUnlimited referenced this in commit f6072117b2 on Nov 26, 2018
  38. jasonbcox referenced this in commit b660a2d9f5 on Oct 11, 2019
  39. jonspock referenced this in commit 0c6abd5881 on Dec 25, 2019
  40. jonspock referenced this in commit 6c6044d2fc on Dec 26, 2019
  41. jonspock referenced this in commit 623b2e06a5 on Dec 27, 2019
  42. PastaPastaPasta referenced this in commit 3ed39fb7e8 on Jun 27, 2021
  43. PastaPastaPasta referenced this in commit 3639112c81 on Jun 28, 2021
  44. PastaPastaPasta referenced this in commit 1bbf70330f on Jun 29, 2021
  45. PastaPastaPasta referenced this in commit c079031e99 on Jun 29, 2021
  46. PastaPastaPasta referenced this in commit 017708af12 on Jun 29, 2021
  47. PastaPastaPasta referenced this in commit f411978924 on Jun 29, 2021
  48. PastaPastaPasta referenced this in commit 4c80a5f989 on Jun 29, 2021
  49. PastaPastaPasta referenced this in commit 7c120a7124 on Jul 1, 2021
  50. Munkybooty referenced this in commit 90c89bbfe8 on Jul 1, 2021
  51. MarcoFalke locked this on Sep 8, 2021

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-12-18 18:12 UTC

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