Cleanups + nit fixes for walletdir PR #11726

pull meshcollider wants to merge 2 commits into bitcoin:master from meshcollider:201711_walletdir changing 6 files +19 −8
  1. meshcollider commented at 12:56 AM on November 19, 2017: contributor

    This addresses the remaining nits from #11466

    • Updates doc/files.md with respect to the new default wallet directory
    • Fixes @promag and @laanwj's error message nit, and Jonas' release notes nit
    • ~Addresses @laanwj's net-specific wallet subdirectory concern in the case that a walletdir is specified~
    • Changes the #includes from "" to <> style after #11651
  2. fanquake added the label Wallet on Nov 19, 2017
  3. in src/wallet/walletutil.cpp:18 in 70ba89d5f6 outdated
      13 | @@ -14,6 +14,10 @@ fs::path GetWalletDir()
      14 |              // If the path specified doesn't exist, we return the deliberately
      15 |              // invalid empty string.
      16 |              path = "";
      17 | +        } else {
      18 | +            if (fs::is_directory(path / BaseParams().DataDir())) {
    


    laanwj commented at 10:06 AM on November 19, 2017:

    This is a tricky case but after thinking a bit, I think this should be unconditional. If the user wants to use their walletdir with testnet/regtest, they should create a subdir for it in the walletdir. Otherwise this will still result in wallet directory collision by default if -walletdir is specified in bitcoin.conf. We really want to avoid the case where accidentally, say, a regtest wallet is used on mainnet or vice versa.


    laanwj commented at 3:59 PM on November 21, 2017:

    After discussion on IRC, I realized maybe we don't want to do this at all and just wait for #10996 to go in. This will remove the issue by making it possible to set a separate walletdir per network.


    meshcollider commented at 12:13 AM on November 29, 2017:

    Agreed, #10996 or something similar would be much cleaner. Removed.

  4. in src/wallet/init.cpp:198 in 70ba89d5f6 outdated
     193 | @@ -194,7 +194,11 @@ bool VerifyWallets()
     194 |      }
     195 |  
     196 |      if (gArgs.IsArgSet("-walletdir") && !fs::is_directory(GetWalletDir())) {
     197 | -        return InitError(strprintf(_("Error: Specified wallet directory \"%s\" does not exist."), gArgs.GetArg("-walletdir", "").c_str()));
     198 | +        if(!fs::exists(GetWalletDir())) {
     199 | +            return InitError(strprintf(_("Specified wallet directory \"%s\" does not exist."), gArgs.GetArg("-walletdir", "").c_str()));
    


    promag commented at 12:39 PM on November 19, 2017:

    Remove default value "" here and below? GetArg()must be called with default value.

  5. in src/wallet/init.cpp:197 in 70ba89d5f6 outdated
     193 | @@ -194,7 +194,11 @@ bool VerifyWallets()
     194 |      }
     195 |  
     196 |      if (gArgs.IsArgSet("-walletdir") && !fs::is_directory(GetWalletDir())) {
     197 | -        return InitError(strprintf(_("Error: Specified wallet directory \"%s\" does not exist."), gArgs.GetArg("-walletdir", "").c_str()));
     198 | +        if(!fs::exists(GetWalletDir())) {
    


    promag commented at 12:40 PM on November 19, 2017:

    Suggestion:

    if (exists) {
        return "not a directory";
    }
    
    return "does not exists";
    

    MarcoFalke commented at 6:32 PM on November 22, 2017:

    nit: (in case you touch the pull for other reasons): Add space after if (or use clang-format).

  6. in doc/files.md:10 in 70ba89d5f6 outdated
       5 | @@ -6,13 +6,13 @@
       6 |  * blocks/rev000??.dat; block undo data (custom); since 0.8.0 (format changed since pre-0.8)
       7 |  * blocks/index/*; block index (LevelDB); since 0.8.0
       8 |  * chainstate/*; block chain state database (LevelDB); since 0.8.0
       9 | -* database/*: BDB database environment; only used for wallet since 0.8.0
      10 | -* db.log: wallet database log file
    


    promag commented at 4:34 PM on November 27, 2017:

    Follow blktree/ and blocks/index/* example:

    * db.log: wallet database log file; replaced by wallets/ directory in 0.16.0
    * wallets/db.log; since 0.16.0
    

    Same for wallet.dat.

  7. meshcollider commented at 12:14 AM on November 29, 2017: contributor

    @promag I've made an attempt at updating the files.md as you suggested, feel free to suggest a different change though if you're not happy still :)

  8. in doc/files.md:16 in 9e3ca91bd1 outdated
      14 |  * fee_estimates.dat: stores statistics used to estimate minimum transaction fees and priorities required for confirmation; since 0.10.0
      15 |  * mempool.dat: dump of the mempool's transactions; since 0.14.0.
      16 |  * peers.dat: peer IP address database (custom format); since 0.7.0
      17 | -* wallet.dat: personal wallet (BDB) with keys and transactions
      18 | +* wallet.dat: personal wallet (BDB) with keys and transactions; moved to wallets/ directory on new installs since 0.16.0
      19 | +* wallets/database/*: BDB database environment; only used for wallet since 0.8.0; since 0.16.0
    


    TheBlueMatt commented at 8:37 PM on December 8, 2017:

    since 0.8.0; since 0.16.0...wait...huh

  9. in src/wallet/init.cpp:198 in 9e3ca91bd1 outdated
     193 | @@ -194,7 +194,10 @@ bool VerifyWallets()
     194 |      }
     195 |  
     196 |      if (gArgs.IsArgSet("-walletdir") && !fs::is_directory(GetWalletDir())) {
     197 | -        return InitError(strprintf(_("Error: Specified wallet directory \"%s\" does not exist."), gArgs.GetArg("-walletdir", "").c_str()));
     198 | +        if (fs::exists(GetWalletDir())) {
     199 | +            return InitError(strprintf(_("Specified wallet directory \"%s\" is not a directory."), gArgs.GetArg("-walletdir", "").c_str()));
    


    promag commented at 2:14 AM on December 10, 2017:

    IMO this is better Specified -walletdir \"%s\" is not a directory (no period and references parameter name).


    meshcollider commented at 11:02 PM on December 12, 2017:

    Done

  10. in src/wallet/init.cpp:200 in 9e3ca91bd1 outdated
     193 | @@ -194,7 +194,10 @@ bool VerifyWallets()
     194 |      }
     195 |  
     196 |      if (gArgs.IsArgSet("-walletdir") && !fs::is_directory(GetWalletDir())) {
     197 | -        return InitError(strprintf(_("Error: Specified wallet directory \"%s\" does not exist."), gArgs.GetArg("-walletdir", "").c_str()));
     198 | +        if (fs::exists(GetWalletDir())) {
     199 | +            return InitError(strprintf(_("Specified wallet directory \"%s\" is not a directory."), gArgs.GetArg("-walletdir", "").c_str()));
     200 | +        }
     201 | +        return InitError(strprintf(_("Specified wallet directory \"%s\" does not exist."), gArgs.GetArg("-walletdir", "").c_str()));
    


    promag commented at 2:15 AM on December 10, 2017:

    Same as above.


    meshcollider commented at 11:02 PM on December 12, 2017:

    Done

  11. meshcollider commented at 11:03 PM on December 12, 2017: contributor

    Updated as per @promag comments, tests are already present in multiwallet.py but I've updated them with the new error messages

  12. Cleanups for walletdir PR b67342906c
  13. Update files.md for new wallets/ subdirectory aac6b3f067
  14. ryanofsky commented at 2:04 PM on December 18, 2017: member

    utACK aac6b3f06717626b88cdfd140f2cc1a3f2dde4be

  15. TheBlueMatt commented at 4:49 PM on December 19, 2017: member

    utACK aac6b3f06717626b88cdfd140f2cc1a3f2dde4be

  16. MarcoFalke commented at 10:37 PM on December 20, 2017: member

    Looks sufficiently reviewed. Going to merge.

    -----BEGIN PGP SIGNED MESSAGE-----
    Hash: SHA512
    
    utACK aac6b3f06717626b88cdfd140f2cc1a3f2dde4be
    -----BEGIN PGP SIGNATURE-----
    
    iQIcBAEBCgAGBQJaOuXFAAoJENLqSFDnUosl4BkP/1DQF5ffK+3slLPF4IUvyYcU
    dv4lh8ME76sjlsy/D+D2Do41o4oJ9gsBdyl9Wv9aPdxEDXOdaYm7H8Kej3ANHEJ0
    yBDYwpAALqccfHo75DQqvHiZ+rQ5AJaSby1i4Pc373BhJK+zGVWov0yN7iMW5OJw
    tekBwNFH11r7B8B5bE/s3YYbXO4oRHp3gRtufe0OSzHVWh+qvdo/G037LRQKEGsZ
    4tmOagZNI7MO8bfMa0+Ctva+cEAD8QVgIlOoXDbG8rq6p9wGQMtZl/sBUocClV0i
    Z04brGvHzhtuykHxKQH6XprDZvvax5lArtSyIYkQyIk5ad1eSU7/sFo0AiAqnUSr
    8PMwTQTo878f7a+/3uhxaCzLkK/c47FaiLpb4fivY7EhWBV3gR4VTRHiLIbWS1fn
    jmt728qj/dLVUYvwUKtjDTkZeTkqc92PnkMmPIKrVJZuzJIu1e44iRGLAERumsAu
    z+eOcZOjBbwERi0aUzcQwe1ZDH+iWNPVXmHq/vCaRiNrgXlmKsN5v9mepVgGP0+f
    3WsvP45o2JtFr942wuzWrRtsg/Bb4wVMFrBWK9iviHYBx+dkMfhWbIGh9BDejPVJ
    dw9z5m4NQ01yRF8f0LUTk84sqOsctSLqp2arkk5xRO903DowbUyNUQLexXfII7ZM
    ojKeCLR3vObZg/GNXaXg
    =jl+C
    -----END PGP SIGNATURE-----
    
  17. MarcoFalke merged this on Dec 20, 2017
  18. MarcoFalke closed this on Dec 20, 2017

  19. MarcoFalke referenced this in commit 604e08c83c on Dec 20, 2017
  20. meshcollider deleted the branch on Dec 21, 2017
  21. UdjinM6 referenced this in commit 588f34c1ff on Feb 29, 2020
  22. PastaPastaPasta referenced this in commit be7bf2e9d8 on Mar 4, 2020
  23. ckti referenced this in commit 00d5d478ae on Mar 28, 2021
  24. gades referenced this in commit fd48b7614e on Jun 30, 2021
  25. furszy referenced this in commit b04e1f5a90 on Jul 23, 2021
  26. DrahtBot 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: 2026-04-13 15:15 UTC

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