Skip to content

Conversation

ryanofsky
Copy link
Contributor

Change wallet loading code to access settings through the Chain interface instead of writing settings.json directly. This is for running wallet and node in separate processes, since multiprocess code wouldn't easily work with different processes updating the same file.


This PR is part of the process separation project. The commit was first part of larger PR #10102.

Change wallet loading code to access settings through the Chain
interface instead of writing settings.json directly.
@DrahtBot
Copy link
Contributor

DrahtBot commented Jun 11, 2021

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

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #17581 (refactor: Remove settings merge reverse precedence code by ryanofsky)
  • #17580 (refactor: Add ALLOW_LIST flags and enforce usage in CheckArgFlags by ryanofsky)
  • #17493 (util: Forbid ambiguous multiple assignments in config file by ryanofsky)
  • #16545 (refactor: Implement missing error checking for ArgsManager flags by ryanofsky)

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

@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.

Code review ACK 49ee2a0

@jamesob
Copy link
Contributor

jamesob commented Aug 11, 2021

ACK 49ee2a0 (jamesob/ackr/22217.1.ryanofsky.refactor_avoid_wallet_co)

Change seems straightforward and benign. Just want to confirm that there's no need to update the two other calls to updateRwSetting in wallet/wallet.cpp (AddWalletSetting/RemoveWalletSetting).

@ryanofsky
Copy link
Contributor Author

ACK 49ee2a0 (jamesob/ackr/22217.1.ryanofsky.refactor_avoid_wallet_co)

Thanks!

Change seems straightforward and benign. Just want to confirm that there's no need to update the two other calls to updateRwSetting in wallet/wallet.cpp (AddWalletSetting/RemoveWalletSetting).

That's right. It's safe for the wallet to use the Chain interface to update settings file, because the Chain interface methods are callable from the bitcoin-wallet process but execute in the bitcoin-node process. It is not safe for wallet code to use the gArgs methods to read and write json settings, because then the bitcoin-wallet process would be accessing the same settings as the bitcoin-node process and corrupting them or getting them out of sync between the two processes.

@Zero-1729
Copy link
Contributor

crACK 49ee2a0

@meshcollider meshcollider merged commit e9d6eb1 into bitcoin:master Aug 22, 2021
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Oct 15, 2021
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Aug 22, 2022
@ryanofsky
Copy link
Contributor Author

This PR caused an unintended change in behavior. Before this PR, passing -nowallet=0would cause a wallet "1" to be loaded. After this PR, it triggers a vague "JSON value of type bool is not of expected type string" error and uncaught exception. #30684 improves this by avoiding the exception and making the error clearer.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
Development

Successfully merging this pull request may close these issues.

5 participants