Prevent wallet unload on GetWalletForJSONRPCRequest #24678

pull promag wants to merge 1 commits into bitcoin:master from promag:2022-03-getwallets changing 3 files +12 −5
  1. promag commented at 10:49 PM on March 25, 2022: member

    Don't extend shared ownership of all wallets to GetWalletForJSONRPCRequest scope.

  2. wallet: Prevent wallet unload on GetWalletForJSONRPCRequest
    Don't extend shared ownership of all wallets to GetWalletForJSONRPCRequest scope.
    f59959e381
  3. DrahtBot added the label RPC/REST/ZMQ on Mar 25, 2022
  4. DrahtBot added the label Wallet on Mar 25, 2022
  5. shaavan approved
  6. shaavan commented at 8:04 AM on March 26, 2022: contributor

    Code Review ACK f59959e3818692c5b3c2dfa51c14e515085e940f

    The reasoning for this change, as far as I understood this PR, is this:

    • In the GetWalletForJSONRPCRequest function, we only needed the wallet shared pointer if the number of context wallets equals one. In other cases, we would like to return an error.
    • So for this, we would not like this function to have information about all the wallets corresponding to context.
    • That is why this PR suggests moving this process of unloading all wallets and returning a single one to a function in the wallet.cpp file.

    I have checked that the changed code is clean and clear to reason with. And if my original understanding of this PR is correct, I think this PR can be merged. And in case my analysis was erroneous, please do correct me.

  7. promag cross-referenced this on Mar 26, 2022 from issue Add and use ForEachWallet by promag
  8. achow101 commented at 5:41 PM on April 19, 2022: member

    What do you mean by "unload" in this context?

  9. promag commented at 5:43 PM on April 19, 2022: member

    The actual wallet unload, which occurs on the last shared pointer.

  10. achow101 commented at 5:54 PM on April 19, 2022: member

    Oh, I see. Is there a scenario where this could actually happen, and if so, can we test for it?

  11. promag commented at 6:37 PM on April 19, 2022: member

    Could happen when an explicit unload races with other call of any wallet. I don't think we can test without code changes.

  12. achow101 commented at 6:56 PM on April 19, 2022: member

    ACK f59959e3818692c5b3c2dfa51c14e515085e940f

  13. theStack approved
  14. theStack commented at 12:06 PM on August 17, 2022: contributor

    Concept and code-review ACK f59959e3818692c5b3c2dfa51c14e515085e940f

  15. fanquake merged this on Aug 17, 2022
  16. fanquake closed this on Aug 17, 2022

  17. sidhujag referenced this in commit 016e6cc96f on Aug 17, 2022
  18. promag deleted the branch on Aug 17, 2022
  19. bitcoin locked this on Aug 17, 2023

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: 2026-05-20 06:53 UTC