Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wallet: Make -wallet setting not create wallets #20186

Merged
merged 1 commit into from Oct 29, 2020

Conversation

ryanofsky
Copy link
Contributor

@ryanofsky ryanofsky commented Oct 19, 2020

This changes -wallet setting to only load existing wallets, not create new ones.

This change should be targeted for 0.21.0. It's a bug fix and simplifies behavior of the #15937 / #19754 / #15454 features added in 0.21.0.


This PR is implementing the simplest, most basic alternative listed in bitcoin-core/gui#95 (comment). Other improvements mentioned there can build on top of this.

@maflcko maflcko added this to the 0.21.0 milestone Oct 19, 2020
Copy link
Member

@maflcko maflcko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

left some nits. No opinion on the actual changes.

doc/release-notes.md Outdated Show resolved Hide resolved
doc/release-notes.md Outdated Show resolved Hide resolved
src/wallet/load.cpp Show resolved Hide resolved
@hebasto
Copy link
Member

hebasto commented Oct 19, 2020

Concept ACK.

@DrahtBot
Copy link
Contributor

DrahtBot commented Oct 19, 2020

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

Conflicts

Reviewers, this pull request conflicts with the following ones:

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.

Copy link
Contributor Author

@ryanofsky ryanofsky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated 1044521 -> bc2b0d9 (pr/nowa.1 -> pr/nowa.2, compare) with suggested tweaks

doc/release-notes.md Outdated Show resolved Hide resolved
doc/release-notes.md Outdated Show resolved Hide resolved
src/wallet/load.cpp Show resolved Hide resolved
Copy link
Contributor

@meshcollider meshcollider left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Concept / utACK bc2b0d9

@hebasto
Copy link
Member

hebasto commented Oct 21, 2020

Testing bc2b0d9 with the GUI.

Steps:

  1. having two wallets: a bdb, and a sqlite
  2. in the GUI open the both wallets, and shutdown
  3. verifying that the both wallets are written into the settings.json
  4. rename/remove the sqlite wallet
  5. start bitcoin-qt, observing a nice warning (on master a new bdb wallet was created silently)
  6. in the GUI only the bdb wallet is loaded (please note this)
  7. shutdown bitcoin-qt and expecting to see in the settings.json the list of wallets that were loaded before shutdown, i.e., only the bdb wallet, but both wallets are actually listed

Is such behavior expected? If "yes", is it worth to document it?

doc/release-notes.md Outdated Show resolved Hide resolved
Copy link
Member

@hebasto hebasto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK bc2b0d9

src/wallet/load.cpp Show resolved Hide resolved
Copy link
Contributor Author

@ryanofsky ryanofsky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

re: #20186 (comment)

Is such behavior expected? If "yes", is it worth to document it?

This comment describes the behavior (which is expected behavior) but doesn't describe which parts of the behavior are good or bad, or which parts of the behavior are undocumented. Maybe reading list of alternatives bitcoin-core/gui#95 (comment) would clarify approach in this PR. This PR is just doing the simplest possible thing it can do to avoid creating wallets unintentionally. Other improvements like displaying temporarily unavailable wallets or updating the settings file can build on top of this PR, but would be more complicated followups.

If the problem here is just documentation, it would help to have a specific suggestion how to improve the documentation.

doc/release-notes.md Outdated Show resolved Hide resolved
src/wallet/load.cpp Show resolved Hide resolved
Copy link
Contributor

@jonatack jonatack left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Concept/approach ACK. Some optional comments below.

doc/release-notes.md Show resolved Hide resolved
doc/release-notes.md Outdated Show resolved Hide resolved
doc/release-notes.md Outdated Show resolved Hide resolved
src/wallet/init.cpp Outdated Show resolved Hide resolved
@jonasschnelli
Copy link
Contributor

Concept ACK

Copy link
Contributor Author

@ryanofsky ryanofsky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for reviews! Just updated with documentation tweaks.


Updated bc2b0d9 -> e368d2b (pr/nowa.2 -> pr/nowa.3, compare) with suggested changes to documentation

doc/release-notes.md Show resolved Hide resolved
doc/release-notes.md Outdated Show resolved Hide resolved
doc/release-notes.md Outdated Show resolved Hide resolved
src/wallet/init.cpp Outdated Show resolved Hide resolved
This changes -wallet setting to only load existing wallets, not create new ones.

- Fixes settings.json corner cases reported by sjors & promag:
  bitcoin-core/gui#95,
  bitcoin#19754 (comment),
  bitcoin#19754 (comment)

- Prevents accidental creation of wallets reported most recently by jb55
  http://www.erisian.com.au/bitcoin-core-dev/log-2020-09-14.html#l-355

- Simplifies behavior after bitcoin#15454. bitcoin#15454 took the big step of disabling
  creation of the default wallet. This PR extends it to avoid creating other
  wallets as well. With this change, new wallets just aren't created on
  startup, instead of sometimes being created, sometimes not. bitcoin#15454 release
  notes are updated here and are simpler.

This change should be targeted for 0.21.0. It's a bug fix and simplifies
behavior of the bitcoin#15937 / bitcoin#19754 / bitcoin#15454 features added in 0.21.0.
@ryanofsky
Copy link
Contributor Author

Rebased e368d2b -> 01476a8 (pr/nowa.3 -> pr/nowa.4, compare) due to conflict with #19967

@achow101
Copy link
Member

ACK 01476a8

Copy link
Member

@luke-jr luke-jr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Concept ACK

But I think it should error, not just warn (maybe with a way to suppress the error to a warning per-wallet?). And there should probably be some command-line option for load-or-create...

Copy link
Member

@hebasto hebasto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

re-ACK 01476a8

@laanwj
Copy link
Member

laanwj commented Oct 29, 2020

Concept ACK. I agree creating wallets is better left as an explicit operation.

@ryanofsky
Copy link
Contributor Author

ACK roundup

meshcollider utACK #20186 (review)
hebasto ACK #20186 (review)
achow101 ACK #20186 (comment)

jonatack concept ACK #20186 (review)
jonasschnelli concept ACK #20186 (comment)
luke-jr concept ACK #20186 (review)

If anyone else is curious to review, the code change is very simple. PR is 90% documentation and test changes

Copy link
Member

@maflcko maflcko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

review ACK 01476a8 🏂

Show signature and timestamp

Signature:

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

review ACK 01476a88a6095fd3af71cb9bf1eadef920a1197b 🏂
-----BEGIN PGP SIGNATURE-----

iQGzBAEBCgAdFiEE+rVPoUahrI9sLGYTzit1aX5ppUgFAlwqrYAACgkQzit1aX5p
pUgBvwv/bY+eUShaDOuvAG0i9cebopzCwinm/okeSaUY8n7+aFqqXQCLxCyDUqjd
iy7tG01DaGjtqwGNfHRzSM6aOLEokQDKG3jwwMLn6FhofEsvfUhyBPrf282pjyeQ
81CdmAwM/jZv1ZEMIRZ+NTGzoRPsSmXbIF5T8SEz1D1lxtu4ZZkQu+sP9aCCPgDW
W30fi++JD0y7E3R3Qzkzgj+XjUAfE31ishJ8omXn6RYpZ905D/XQYsi8qnRcg0Zb
tE3LhCcUa2OJaN6suBWI/C9YKP2a5y7Kv2+4DVEJHDieAsjQFiGkkmqr3WLWChZF
zuP0diiTO4pKGl0LEBfGmP58yxqBWkaBtf6J9xNg/2lOJf5Hca1qYrRQ82YUBsOq
a90o5DSuuE+Su3GPa5npdJ4TKH1cHK3zPW2ntYEHFhCheV6I46Snij0oYlq/odS0
AZHwD7Wcf1Hs3adPOqSBeFT5k1gv7j7KR/d3nCh0LzfbR7/GQtA7brDVnSUVOhjg
guDVKx3B
=B5t/
-----END PGP SIGNATURE-----

Timestamp of file with hash 8c05cf2e3a6f8f2bf14f360a9f14a7a7d62deab81e5fc85dad09447ac883fef6 -


New wallets can be created through the GUI (which has a more prominent create
wallet option), through the `bitcoin-cli createwallet` or `bitcoin-wallet
create` commands, or the `createwallet` RPC. (#15454)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
create` commands, or the `createwallet` RPC. (#15454)
create` commands, or the `createwallet` RPC. (#15454, #20186)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bitcoin Core will no longer automatically create new wallets on startup. It will
load existing wallets specified by `-wallet` options on the command line or in
`bitcoin.conf` or `settings.json` files. And by default it will also load a
top-level unnamed ("") wallet. However, if specified wallets don't exist,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
top-level unnamed ("") wallet. However, if specified wallets don't exist,
top-level unnamed ("") wallet if it exists. However, if specified wallets don't exist,

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

re: #20186 (comment)

My brain might just be poisoned from looking at this paragraph too many times, but "if it exists" seems like a suspicious condition to add. Like going to a bank teller and saying "I am not robbing this bank today." The paragraph starts off by saying new wallets won't be created, and if a wallet doesn't exist it can't be loaded. Anyway this can be edited in the wiki if someone has a better sense

@maflcko maflcko merged commit 42b66a6 into bitcoin:master Oct 29, 2020
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Oct 29, 2020
01476a8 wallet: Make -wallet setting not create wallets (Russell Yanofsky)

Pull request description:

  This changes `-wallet` setting to only load existing wallets, not create new ones.

  - Fixes settings.json corner cases reported by sjors & promag: bitcoin-core/gui#95, bitcoin#19754 (comment), bitcoin#19754 (comment)

  - Prevents accidental creation of wallets reported most recently by jb55 http://www.erisian.com.au/bitcoin-core-dev/log-2020-09-14.html#l-355

  - Simplifies behavior after bitcoin#15454. bitcoin#15454 took the big step of disabling creation of the default wallet. This PR extends it to avoid creating other wallets as well. With this change, new wallets just aren't created on startup, instead of sometimes being created, sometimes not. bitcoin#15454 release notes are updated here and are simpler.

  This change should be targeted for 0.21.0. It's a bug fix and simplifies behavior of the bitcoin#15937 / bitcoin#19754 / bitcoin#15454 features added in 0.21.0.

  ---

  This PR is implementing the simplest, most basic alternative listed in bitcoin-core/gui#95 (comment). Other improvements mentioned there can build on top of this.

ACKs for top commit:
  achow101:
    ACK 01476a8
  hebasto:
    re-ACK 01476a8
  MarcoFalke:
    review ACK 01476a8 🏂

Tree-SHA512: 0d50f4e5dfbd04a2efd9fd66c02085a0ed705807bdec1cf5770d0ae8cb6af07080fb81306349937bf66acdb713d03fb35636f6442b650d0820e66cbae09c2f87
Copy link
Member

@promag promag left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code review ACK 01476a8.

@ryanofsky not sure if the following should be fixed:

Running with an empty datadir:

bitcoind -regtest -wallet=""

Gives

<datadir>/regtest/wallets'. Data is not in recognized format.

@bitcoin bitcoin locked as resolved and limited conversation to collaborators Feb 15, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet