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

Don't abort launch when failing to load a future wallet #95

Open
Sjors opened this issue Sep 17, 2020 · 15 comments
Open

Don't abort launch when failing to load a future wallet #95

Sjors opened this issue Sep 17, 2020 · 15 comments
Labels
UX All about "how to get things done"

Comments

@Sjors
Copy link
Member

Sjors commented Sep 17, 2020

The new settings.json introduced in bitcoin/bitcoin#15935 creates a problem when downgrading a node. E.g. try creating a hardware wallet enabled wallet with #4 and then downgrade back to master. It will fail at launch with "Wallet requires newer version of Bitcoin Core". You then have to manually delete the settings.json file.

It would be better if QT continues to load, but without the wallet, when this happens.

@Sjors Sjors added the Feature label Sep 17, 2020
@Sjors
Copy link
Member Author

Sjors commented Sep 17, 2020

cc @ryanofsky @achow101

@Sjors Sjors removed the Feature label Sep 17, 2020
@jonasschnelli
Copy link
Contributor

This could be potentially harmful for pruned peers where syncing the chain may cause the wallet to fall behind the prune depth and thus require a fresh sync of the whole chain.

So I’m unsure about this. I think the current behavior (stop on wallet load failure) is preferable and the saner option. One option would be to threat pruned peers different... but sounds meh.

@promag
Copy link
Contributor

promag commented Sep 17, 2020

@jonasschnelli that's already a problem with multiwallet? When a wallet is needed and loaded it can already require a sync.

@Sjors
Copy link
Member Author

Sjors commented Sep 17, 2020

If could be a Yes / No prompt.

@jonasschnelli
Copy link
Contributor

@promag with multiwallet, it is an issue if you manually load or unload a wallet. The GUI should probably warn about that (it gets less critical once we automatically load manual loaded wallets after a restart).

But wallets set to load via the startup arguments should probably never silently unload.

@promag
Copy link
Contributor

promag commented Sep 17, 2020

Agreed, unnecessary source of panic. A warning or so would do the trick as @Sjors suggest.

@ryanofsky
Copy link
Contributor

ryanofsky commented Sep 17, 2020

Good catch. A similar problem was discussed in bitcoin/bitcoin#19754 (comment) and bitcoin/bitcoin#15454 (comment)
about what should happen if a previously loaded wallet in settings.json could no longer be loaded because it was deleted/moved/unmounted. Different options mentioned there were:

  1. Quietly not load the wallet, just logging a warning
  2. Quietly not load the wallet, logging a warning, and removing it from settings.json so it doesn't get automatically loaded again in the future.
  3. Show a modal prompt like "Wallet <wallet name> could not be loaded because of <reason>, do you want to try to load it next time Bitcoin Core is started?"
  4. Load the wallet, but show indications it is having problems, and limit interactions disabling the transaction list or controls that won't work. Allow switching to the wallet in the GUI dropdown and unloading it with the "File -> Close Wallet...", like other wallets to avoid loading it again in the future.

@promag
Copy link
Contributor

promag commented Sep 17, 2020

What would be the corresponding RPC approach for 4.?

@promag
Copy link
Contributor

promag commented Sep 17, 2020

I like option 4. but that would require a new wallet state to be checked in lots of places. Maybe it's an easy change like, for instance, add the new check in GetWalletForJSONRPCRequest. I could give it a try if everyone agrees with it.

@ryanofsky
Copy link
Contributor

What would be the corresponding RPC approach for 4.?

I think ideally GUI & RPC behavior match and share the same implementation. So wallet would be listed in listwallets, and could be unloaded with unloadwallet taking a load_on_startup option. Trying to list transactions, or get the balance, or generate addresses would result in RPC errors. (Though maybe showing transactions or balances could theoretically work in external signer case? Unsure.)

I like option 4. but that would require a new wallet state to be checked in lots of places. Maybe it's an easy change like, for instance, add the new check in GetWalletForJSONRPCRequest. I could give it a try if everyone agrees with it.

I think that'd be great, and I'd be interested in seeing this. I think a representation for a wallet that couldn't be loaded might be a CWallet instance with a null database pointer, or a dummy database pointer if null is too big of a change. I'm hazy on what error indication might look like in the GUI. Maybe some kind of error marker next to wallet names in the list, and error details shown when the wallet is selected

@maflcko
Copy link
Contributor

maflcko commented Oct 1, 2020

Is this something that should be fixed before the next major release?

@promag
Copy link
Contributor

promag commented Oct 1, 2020

I have a branch with 4. but it's not pretty, it's based on bitcoin/bitcoin#19980.

I think this is not a blocker, especially because the "fix" is what @Sjors had to do.

@maflcko
Copy link
Contributor

maflcko commented Oct 1, 2020

Oh right, a verbose abort is better than a silent ignore. Can be fixed later.

ryanofsky added a commit to ryanofsky/bitcoin that referenced this issue Oct 19, 2020
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 targetted 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 added a commit to ryanofsky/bitcoin that referenced this issue Oct 19, 2020
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 targetted 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 added a commit to ryanofsky/bitcoin that referenced this issue Oct 21, 2020
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 targetted 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 added a commit to ryanofsky/bitcoin that referenced this issue Oct 21, 2020
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 targetted 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 added a commit to ryanofsky/bitcoin that referenced this issue Oct 21, 2020
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.
maflcko pushed a commit that referenced this issue 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: #95, bitcoin/bitcoin#19754 (comment), bitcoin/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 #15454. #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. #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 #15937 / #19754 / #15454 features added in 0.21.0.

  ---

  This PR is implementing the simplest, most basic alternative listed in #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
@ryanofsky
Copy link
Contributor

I was going to close this issue since I thought bitcoin/bitcoin#20186 resolved it, but actually bitcoin/bitcoin#20186 would need to be broadened a little to change the "the wallet requires a newer version" error into a warning that skips loading the wallet.

bitcoin/bitcoin#20186 only shows the warning for wallets which don't exist, not wallets which fail to load for other reasons. It implements the first of four possible solutions described #95 (comment). We could go with one of the other solutions, or a different fix for this issue. @promag, I'd still be curious to see what you came up with in #95 (comment)

@promag
Copy link
Contributor

promag commented Oct 29, 2020

I have a branch with 4. but it's not pretty, it's based on bitcoin/bitcoin#19980.

@ryanofsky hope to push today.

sidhujag pushed a commit to syscoin/syscoin that referenced this issue 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
janus pushed a commit to janus/bitgesell that referenced this issue Dec 13, 2020
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/bitcoin#19754 (comment),
  bitcoin/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 #15454. #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. #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 #15937 / #19754 / #15454 features added in 0.21.0.
@hebasto hebasto added the Feature label Mar 6, 2021
@hebasto hebasto added the UX All about "how to get things done" label May 1, 2021
@hebasto hebasto removed the Feature label May 1, 2021
Fabcien pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this issue Jan 12, 2024
Summary:
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/bitcoin#19754 (comment),
  bitcoin/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 #15454. #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. #15454 release
  notes are updated here and are simpler.

It is a bug fix and simplifies behavior of the [[bitcoin/bitcoin#15937 | core#15937]] / [[bitcoin/bitcoin#19754 | core#19754]] / [[bitcoin/bitcoin#15454 | core#15454]] features

This is a backport of [[bitcoin/bitcoin#20186 | core#20186]]

Depends on D15143 and D14142

Test Plan:
`ninja all check-all`

With bitcoin-qt, create and load a wallet, close the program. In the file explorer rename the wallet directory. Restart bitcoin-qt and check that now the old wallet name is not recreated (in addition to the wallet with the new name) but an error message warns about it not being found. The new wallet name is now the only wallet avaialble.

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Subscribers: Fabien

Differential Revision: https://reviews.bitcoinabc.org/D15144
EyeOfPython pushed a commit to raipay/bitcoin-abc that referenced this issue Jan 16, 2024
Summary:
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/bitcoin#19754 (comment),
  bitcoin/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 #15454. #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. #15454 release
  notes are updated here and are simpler.

It is a bug fix and simplifies behavior of the [[bitcoin/bitcoin#15937 | core#15937]] / [[bitcoin/bitcoin#19754 | core#19754]] / [[bitcoin/bitcoin#15454 | core#15454]] features

This is a backport of [[bitcoin/bitcoin#20186 | core#20186]]

Depends on D15143 and D14142

Test Plan:
`ninja all check-all`

With bitcoin-qt, create and load a wallet, close the program. In the file explorer rename the wallet directory. Restart bitcoin-qt and check that now the old wallet name is not recreated (in addition to the wallet with the new name) but an error message warns about it not being found. The new wallet name is now the only wallet avaialble.

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Subscribers: Fabien

Differential Revision: https://reviews.bitcoinabc.org/D15144
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
UX All about "how to get things done"
Projects
None yet
Development

No branches or pull requests

6 participants