wallet: Make -walletdir network only #17447

pull promag wants to merge 1 commits into bitcoin:master from promag:2019-11-fix-15630 changing 1 files +1 −1
  1. promag commented at 12:28 AM on November 12, 2019: member

    With this PR bitcoind -regtest doesn't run if bitcoin.conf has

    walletdir=/mnt/mydisk/wallets
    

    But works with

    [regtest]
    walletdir=/mnt/mydisk/wallets
    

    Doesn't change mainnet behavior.

    Closes #15630.

  2. wallet: Make -walletdir network only 3c2c439dcd
  3. fanquake added the label Wallet on Nov 12, 2019
  4. promag commented at 10:24 AM on November 12, 2019: member

    Seeking concept ACK.

  5. MarcoFalke added the label Brainstorming on Nov 12, 2019
  6. hebasto commented at 7:22 AM on November 13, 2019: member

    How will it work if walletdir is specified somewhere out of the datadir?

  7. promag commented at 9:32 AM on November 13, 2019: member

    @hebasto same as before, only change is you must have -walletdir after the network, like after [regtest].

  8. MarcoFalke commented at 1:39 PM on November 13, 2019: member

    In other words: This is a test-only change.

  9. promag commented at 2:17 PM on November 13, 2019: member

    In other words: This is a test-only change.

    No? bitcoind won't run if bitcoin.conf has

    walletdir=/mnt/mydisk/wallets
    

    But works with

    [main]
    walletdir=/mnt/mydisk/wallets
    
  10. MarcoFalke commented at 2:36 PM on November 13, 2019: member

    No. See https://dev.visucore.com/bitcoin/doxygen/system_8cpp_source.html#l00248

    This boots up fine for me:

    $ cat /tmp/a
    uacomment=Alice
    datadir=/tmp
    rpcport=33333
    $ ./src/qt/bitcoin-qt -conf=/tmp/a
    
  11. promag commented at 3:06 PM on November 13, 2019: member

    Right, thanks for the correction, updated OP.

  12. promag marked this as ready for review on Nov 13, 2019
  13. ryanofsky commented at 4:18 PM on November 13, 2019: member

    ACK 3c2c439dcd8797019ac6d6614775d5c20ee41c36

    Maybe could use release notes like:

    It is now an error to use an unqualified walletdir=path setting in the config file if bitcoin is running on testnet or regtest networks. The setting now needs to be qualified as test.walletdir=path, regtest.walletdir=path, or main.walletdir=path or placed in the appropriate [test] [regtest] or [main] section.

    When I first looked at this I thought there might be tenuous use-case for not making -walletdir a network-specific setting: that you could specify a relative path like walletdir=russwallets have bitcoin automatically use appropriate ~/.bitcoin/russwallets, ~/.bitcoin/testnet3/russwallets, etc directories depending on the network. But actually there appears to be another bug where the directory isn't even interpreted relative to datadir.

    https://github.com/bitcoin/bitcoin/blob/cd6cb9745e13a62e130b11f78a13bcc1d424b05e/src/wallet/load.cpp#L21

    It probably would be better to change this to:

        fs::path canonical_wallet_dir = fs::canonical(wallet_dir, GetDataDir(), error);
    

    Something for another PR, though.

  14. ryanofsky commented at 4:29 PM on November 13, 2019: member

    Maybe say what benefit of the change is in the PR description. It should decrease the likelihood of opening a wallet file from the wrong chain when walletdir is used, helping with #12805 a little.

  15. MarcoFalke removed the label Brainstorming on Nov 13, 2019
  16. DrahtBot commented at 12:56 AM on November 16, 2019: member

    <!--e57a25ab6845829454e8d69fc972939a-->

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

    <!--174a7506f384e20aa4161008e828411d-->

    Conflicts

    No conflicts as of last run.

  17. laanwj commented at 2:10 PM on November 18, 2019: member

    It should decrease the likelihood of opening a wallet file from the wrong chain when walletdir is used, helping with #12805 a little.

    Oof. Concept ACK.

  18. MarcoFalke commented at 2:19 PM on November 18, 2019: member

    Needs release notes for "test-only changes"?

    ACK 3c2c439dcd8797019ac6d6614775d5c20ee41c36 🍈

    <details><summary>Show signature and timestamp</summary>

    Signature:

    -----BEGIN PGP SIGNED MESSAGE-----
    Hash: SHA512
    
    ACK 3c2c439dcd8797019ac6d6614775d5c20ee41c36 🍈
    -----BEGIN PGP SIGNATURE-----
    
    iQGzBAEBCgAdFiEE+rVPoUahrI9sLGYTzit1aX5ppUgFAlwqrYAACgkQzit1aX5p
    pUiFywwAnEqaW7Ys2ds9z8FV8RZd1M9W5DU+i2lLve7mukLeQwbccDKRNWiYdpN/
    uOdEv19H3pF5brA1GKeHkrtMDmDuhUgIDUfWOTyGO1GAMCsKXzS0x5kw+c2+i01e
    wz/ZMp1lXKGiVhwOPVszNRXuF4b+uICUtMfjYuSRXbMGzJh6aEgD1JqO/vYpn/xJ
    hNdwQ/wZ0FFAud1qRctlDbLuR2zyq/H+TAPdklKtiMa1+xe5qtAXAEG2YfK5PrSL
    6EOSKES7QK4b4wy2SVChpDF9Uc2YXk+bNqghJKJTZZqKfdTiZ3QiLNPDcmOruTyD
    WHsdpCPPt5om7J2Fun2DrYZu+9UX7xLJfAj6MXTeVbSkssZcuORgHWTfGQsdE/KC
    1C7S0ltwm03cVusMAXhOzl4BHUZrYBxQPQUDBy3xQSRVF8XXPQxAdRgf1QFN4GMh
    +dtEXEyIHxv4E3/XfJ3aIr/hlkQtMIjNGLDglhORcGkmrnWnxaKUGpfGX41XT4Mf
    llSvIM0A
    =BTf0
    -----END PGP SIGNATURE-----
    

    Timestamp of file with hash 81fdb0207d259a48252e116f61bb427aa236eefd85d66edb01ea5281abfa70fd -

    </details>

  19. ryanofsky commented at 3:00 PM on November 18, 2019: member

    Needs release notes for "test-only changes"?

    When you are saying test-only do you mean testnet-only? I'd expect changes affecting testnet or manual testing in general could have release notes, but changes just affecting automated c++/python test cases wouldn't typically get release notes.

    Any case the release note I wrote up #17447 (comment) was also meant to provide a better description / motivation for the PR.

  20. MarcoFalke commented at 3:07 PM on November 18, 2019: member

    When you are saying test-only do you mean testnet-only?

    testnet and regtest, or "low level test changes", see here: https://github.com/bitcoin/bitcoin/blob/fec230edcc2ae0ec4fd3811185ad3b1802a5c90b/doc/release-notes/release-notes-0.19.0.md#tests

  21. meshcollider commented at 9:35 PM on November 22, 2019: contributor

    Tested ACK 3c2c439dcd8797019ac6d6614775d5c20ee41c36

  22. meshcollider referenced this in commit 0b79caf658 on Nov 22, 2019
  23. meshcollider merged this on Nov 22, 2019
  24. meshcollider closed this on Nov 22, 2019

  25. sidhujag referenced this in commit 65781f441a on Nov 23, 2019
  26. MarkLTZ referenced this in commit df10656481 on Nov 29, 2019
  27. MarcoFalke added the label Needs release note on Dec 10, 2019
  28. MarcoFalke removed the label Needs release note on Dec 10, 2019
  29. promag commented at 10:29 PM on December 10, 2019: member

    It probably would be better to change this to: @ryanofsky I think that's on purpose - it's the case where -walletdir is explicitly set and should be absolute? In this case maybe the following help could say it must be an absolute path: https://github.com/bitcoin/bitcoin/blob/3d6752779f0504e6435fe682f0c06c60b5c4c33b/src/wallet/init.cpp#L63

  30. promag deleted the branch on Dec 10, 2019
  31. MarcoFalke referenced this in commit 14dafcbc13 on Dec 11, 2019
  32. sidhujag referenced this in commit c53d2af405 on Dec 12, 2019
  33. ryanofsky commented at 6:33 PM on December 16, 2019: member

    re: #17447 (comment), #17447 (comment)

    It probably would be better to change this to:

    @ryanofsky I think that's on purpose - it's the case where -walletdir is explicitly set and should be absolute? In this case maybe the following help could say it must be an absolute path

    Yes I didn't see the check below which requires the path to be absolute. It is pointless to call fs::canonical at all if the path has to be absolute. The change I was suggesting would allow it to be relative to the datadir, but updating the help would be another option.

  34. jasonbcox referenced this in commit 4e8ce19c38 on Oct 1, 2020
  35. sidhujag referenced this in commit d0ca2e8c76 on Nov 10, 2020
  36. sidhujag referenced this in commit 691eb319b3 on Nov 10, 2020
  37. MarcoFalke locked this on Dec 16, 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 18:14 UTC

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