wallet, gui: Reload previously loaded wallets on startup #19754

pull achow101 wants to merge 1 commits into bitcoin:master from achow101:load-on-start-gui changing 10 files +104 −77
  1. achow101 commented at 7:44 pm on August 17, 2020: member

    Enable the GUI to also use the load_on_startup feature. Wallets loaded in the GUI always have load_on_startup=true. When they are unloaded from the GUI, load_on_startup=false.

    To facilitate this change, UpdateWalletSetting is moved into the wallet module and called from within LoadWallet, RemoveWallet, and Createwallet. This change does not actually touch the GUI code but rather the wallet functions that are shared between the GUI and RPC.

  2. DrahtBot added the label GUI on Aug 17, 2020
  3. DrahtBot added the label RPC/REST/ZMQ on Aug 17, 2020
  4. DrahtBot added the label Tests on Aug 17, 2020
  5. DrahtBot added the label Wallet on Aug 17, 2020
  6. achow101 force-pushed on Aug 17, 2020
  7. achow101 force-pushed on Aug 17, 2020
  8. DrahtBot commented at 8:04 pm on August 20, 2020: member

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

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #19619 (Remove wallet.dat path handling from wallet.cpp, rpcwallet.cpp by ryanofsky)
    • #19101 (refactor: remove ::vpwallets and related global variables by ryanofsky)
    • #19077 (wallet: Add sqlite as an alternative wallet database and use it for new descriptor wallets by achow101)
    • #18531 (rpc: Assert that RPCArg names are equal to CRPCCommand ones by MarcoFalke)
    • #17211 (Allow fundrawtransaction and walletcreatefundedpsbt to take external inputs by achow101)

    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.

  9. MarcoFalke removed the label RPC/REST/ZMQ on Aug 23, 2020
  10. MarcoFalke removed the label Tests on Aug 23, 2020
  11. MarcoFalke removed the label GUI on Aug 23, 2020
  12. MarcoFalke removed the label Wallet on Aug 23, 2020
  13. DrahtBot added the label GUI on Aug 23, 2020
  14. DrahtBot added the label RPC/REST/ZMQ on Aug 23, 2020
  15. DrahtBot added the label Wallet on Aug 23, 2020
  16. MarcoFalke removed the label RPC/REST/ZMQ on Aug 23, 2020
  17. ryanofsky approved
  18. ryanofsky commented at 10:15 pm on August 24, 2020: member

    Code review ACK e8bfa09b1c1888c33acfd5dcebbe136bf0d6fe82

    I think the PR title and description here are hard to follow and it would be better to just describe the behavior change that this is implementing: reloading wallets previously loaded in the GUI on startup. A good title might be “gui: Load previously loaded wallets on startup.” Release notes can be updated too with this. Suggest maybe:

     0--- a/doc/release-notes-15937.md
     1+++ b/doc/release-notes-15937.md
     2@@ -1,12 +1,15 @@
     3 Configuration
     4 -------------
     5 
     6-The `createwallet`, `loadwallet`, and `unloadwallet` RPCs now accept
     7-`load_on_startup` options that modify bitcoin's dynamic configuration in
     8-`\<datadir\>/settings.json`, and can add or remove a wallet from the list of
     9-wallets automatically loaded at startup. Unless these options are explicitly
    10-set to true or false, the load on startup wallet list is not modified, so this
    11-change is backwards compatible.
    12+Wallets created or loaded in the GUI will now be automatically loaded on
    13+startup, so they don't need to be manually reloaded next time bitcoin is
    14+started. The list of wallets to load on startup is stored in
    15+`\<datadir\>/settings.json` and augments any command line or `bitcoin.conf`
    16+`-wallet=` settings that specify more wallets to load.  Wallets that are
    17+unloaded in the GUI get removed from the settings list so they won't load again
    18+automatically next startup.
    19 
    20-In the future, the GUI will start updating the same startup wallet list as the
    21-RPCs to automatically reopen wallets previously opened in the GUI.
    22+The `createwallet`, `loadwallet`, and `unloadwallet` RPCs accept new
    23+`load_on_startup` options to modify the settings list. Unless these options are
    24+explicitly set to true or false, the list is not modified, so the RPC methods
    25+remain backward compatible.
    

    Historical note: Commit e8bfa09b1c1888c33acfd5dcebbe136bf0d6fe82 is an expanded version of 546bdce4ece60635a1eb2fa9d46d82ae41aeee24 from #15454. New commit and old commit do the same thing but the new commit does extra refactoring in wallet code.

  19. achow101 force-pushed on Aug 24, 2020
  20. achow101 renamed this:
    wallet: Move UpdateWalletSetting to wallet module and use from GUI interface
    wallet: Reload previously loaded wallets on GUI startup
    on Aug 24, 2020
  21. achow101 commented at 11:34 pm on August 24, 2020: member
    Done as suggested.
  22. ryanofsky approved
  23. ryanofsky commented at 0:00 am on August 25, 2020: member

    Code review ACK 4cff046507df20717084260c9902fcd0733a95fa. Only doc changes since last review.

    I might still try to make the PR description easier to understand. Not referencing #15937 in the first sentence for example, because you don’t need to know about #15937 to understand this PR. The main thing I think this PR is doing is automatically loading previously loaded wallets automatically on startup so you don’t need to load them manually. Rest is refactoring.

    Also could tweak title

    wallet: Reload previously loaded wallets on GUI startup

    to

    gui, wallet: Reload previously loaded wallets on startup

    The “on GUI startup” part seems a little inaccurate because the wallets are loaded on bitcoind startup, too, not just bitcoin-qt startup.

  24. achow101 renamed this:
    wallet: Reload previously loaded wallets on GUI startup
    wallet, gui: Reload previously loaded wallets on GUI startup
    on Aug 25, 2020
  25. achow101 renamed this:
    wallet, gui: Reload previously loaded wallets on GUI startup
    wallet, gui: Reload previously loaded wallets
    on Aug 25, 2020
  26. achow101 renamed this:
    wallet, gui: Reload previously loaded wallets
    wallet, gui: Reload previously loaded wallets on startup
    on Aug 25, 2020
  27. achow101 commented at 1:14 am on August 25, 2020: member
    Updated PR description and title.
  28. DrahtBot added the label Needs rebase on Aug 31, 2020
  29. achow101 force-pushed on Aug 31, 2020
  30. DrahtBot removed the label Needs rebase on Aug 31, 2020
  31. Sjors commented at 7:01 pm on August 31, 2020: member
    tACK 2125f6dd29c9cd7a689c379b81faf7228aea2fec 🎉 The final missing piece for multi wallet imo
  32. in doc/release-notes-15937.md:10 in 2125f6dd29 outdated
    11+startup, so they don't need to be manually reloaded next time Bitcoin is
    12+started. The list of wallets to load on startup is stored in
    13+`\<datadir\>/settings.json` and augments any command line or `bitcoin.conf`
    14+`-wallet=` settings that specify more wallets to load. Wallets that are
    15+unloaded in the GUI get removed from the settings list so they won't load again
    16+automatically next startup.
    


    MarcoFalke commented at 6:09 am on September 1, 2020:
    0automatically next startup. (#19754)
    

    achow101 commented at 4:14 pm on September 1, 2020:
    Done
  33. in doc/release-notes-15937.md:15 in 2125f6dd29 outdated
    18-In the future, the GUI will start updating the same startup wallet list as the
    19-RPCs to automatically reopen wallets previously opened in the GUI.
    20+The `createwallet`, `loadwallet`, and `unloadwallet` RPCs now accept
    21+`load_on_startup` options to modify the settings list. Unless these options are
    22+explicitly set to true or false, the list is not modified, so the RPC methods
    23+remain backwards compatible.
    


    MarcoFalke commented at 6:09 am on September 1, 2020:
    0remain backwards compatible. (#15937)
    

    achow101 commented at 4:14 pm on September 1, 2020:
    Done
  34. MarcoFalke commented at 6:10 am on September 1, 2020: member
    doc nits
  35. wallet: Reload previously loaded wallets on GUI startup
    Enable the GUI to also use the load_on_startup feature.
    Wallets loaded in the GUI always have load_on_startup=true.
    When they are unloaded from the GUI, load_on_startup=false.
    
    To facilitate this change, UpdateWalletSetting is moved into the wallet
    module and called from within LoadWallet, RemoveWallet, and
    Createwallet. This change does not actually touch the GUI code but
    rather the wallet functions that are shared between the GUI and RPC.
    f1ee37319a
  36. achow101 force-pushed on Sep 1, 2020
  37. ryanofsky approved
  38. ryanofsky commented at 0:20 am on September 2, 2020: member
    Code review ACK 952bf2c9eef9d6b2f1a01142191c5f41403ed3de. Just rebased and tweaked release notes since last review
  39. promag commented at 4:41 pm on September 2, 2020: member
    Tested but found a corner case that I think it should be fixed. If I manually move away a wallet then it will be created again. I think that settings.json should never result in new wallets - an entry that doesn’t exists is just skipped maybe?
  40. achow101 commented at 4:54 pm on September 2, 2020: member

    Tested but found a corner case that I think it should be fixed. If I manually move away a wallet then it will be created again. I think that settings.json should never result in new wallets - an entry that doesn’t exists is just skipped maybe?

    I think that’s a bit orthogonal to this PR. It’s part of the settings reading stuff I think. I would prefer that to be fixed in a followup as I believe it is a current bug in the loading implementation.

  41. ryanofsky commented at 5:05 pm on September 2, 2020: member

    Tested but found a corner case that I think it should be fixed. If I manually move away a wallet then it will be created again

    This is similar to what happens with the default wallet currently. If you move it away and restart, it will be created again. I don’t think this PR really changes the situation: all it is doing is expanding the list of default wallets.

    I do agree it would be better not to create settings wallets on startup if they don’t exist. It would be natural to do this in #15454 as part of the change that avoids creating the default wallet.

    I also think we could go further and not create wallets at all on startup. There are 4 sources of wallet names that can be created on startup:

    1. default "" wallet
    2. -wallet command line values
    3. bitcoin.conf wallet values
    4. settings.json wallet values

    Simplest and safest thing would be to just load wallets with these names and not create them

  42. promag commented at 5:52 pm on September 2, 2020: member
    Right right, didn’t mean to fix it here.
  43. promag commented at 5:59 pm on September 2, 2020: member
    Tested ACK 952bf2c9eef9d6b2f1a01142191c5f41403ed3de.
  44. kristapsk approved
  45. kristapsk commented at 0:09 am on September 3, 2020: contributor
    ACK f1ee37319a7a211e5fb325406d62db5b61dbd30e, I have tested the code.
  46. jonasschnelli commented at 4:24 pm on September 3, 2020: contributor
    Tested ACK f1ee37319a7a211e5fb325406d62db5b61dbd30e - works as expected. Wallets loaded via bitcoin-cli (in -server mode) or through the RPC console won’t be loaded on startup but wallets loaded via the GUI menu will.
  47. jonasschnelli merged this on Sep 3, 2020
  48. jonasschnelli closed this on Sep 3, 2020

  49. jonatack commented at 4:25 pm on September 3, 2020: member
    ACK f1ee37319a7a211e5fb325406d62db5b61dbd30e
  50. sidhujag referenced this in commit 8fb2e113b6 on Sep 3, 2020
  51. meshcollider referenced this in commit 652c45fdbb on Sep 18, 2020
  52. sidhujag referenced this in commit 202a5e5958 on Sep 20, 2020
  53. ryanofsky referenced this in commit 1044521921 on Oct 19, 2020
  54. ryanofsky referenced this in commit bc2b0d99a5 on Oct 19, 2020
  55. ryanofsky referenced this in commit e368d2bb3b on Oct 21, 2020
  56. ryanofsky referenced this in commit 23bc6999c2 on Oct 21, 2020
  57. ryanofsky referenced this in commit 01476a88a6 on Oct 21, 2020
  58. MarcoFalke referenced this in commit 42b66a6b81 on Oct 29, 2020
  59. sidhujag referenced this in commit 48063676f9 on Oct 29, 2020
  60. janus referenced this in commit d1ed63a9c2 on Dec 13, 2020
  61. Fabcien referenced this in commit c43171d5a3 on Sep 27, 2021
  62. 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-11-17 09:12 UTC

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