Skip to content

RPC: Restore backward compatibility, in multiwallet mode #10989

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

Closed
wants to merge 1 commit into from

Conversation

luke-jr
Copy link
Member

@luke-jr luke-jr commented Aug 4, 2017

Appears to have been broken by #10849

@ryanofsky
Copy link
Contributor

The check was written this way so explicitly specifying a wallet is required if more than one is loaded. So if, for example, you are writing a script that runs a series of RPCs, and you accidentally forget the wallet option in one of the calls, you get an error message instead of performing an operation or getting data returned from the wrong wallet.

If only one wallet is loaded, providing a wallet parameter should not be necessary, so there should be 100% backwards compatibility with previous releases the way this is written now.

@jonasschnelli
Copy link
Contributor

jonasschnelli commented Aug 4, 2017

Didn't we agree that when running Core with multiple wallets one needs to specify the wallet (instead of default using the first one)? IMO we did agree on that.

PR seems NACKish.

@sipa
Copy link
Member

sipa commented Aug 4, 2017

Yes, this is intentional and changing it looks like a footgun. NACK

@ryanofsky
Copy link
Contributor

Maybe if #10615 is updated, and there's a way to specify default wallets or restricted wallets per user, that could avoid the need to explicitly specify the wallet on the client side when multiple wallets are loaded on the server side.

@luke-jr
Copy link
Member Author

luke-jr commented Aug 4, 2017

@jonasschnelli No, I don't recall agreeing to that. It breaks compatibility with existing software (and also means there is literally no future-supported method to access your wallet when multiple wallets are loaded).

The primary target with multiwallet in this release is to support having other wallets loaded in the background, so they're kept up to date with a pruning node. That is broken by this behaviour...

@ryanofsky I can rebase #10615 on top of this, but AFAIK it's too late for 0.15 since it adds new features. This focuses only on the existing bug.

@jonasschnelli
Copy link
Contributor

@jonasschnelli No, I don't recall agreeing to that. It breaks compatibility with existing software (and also means there is literally no future-supported method to access your wallet when multiple wallets are loaded).

Why? 0.15 is the first release of Core with multiwallet. No versions before could run multiple wallets.

The primary target with multiwallet in this release is to support having other wallets loaded in the background, so they're kept up to date with a pruning node. That is broken by this behaviour...

This seems very dangerous. One quickly messes up the argument order making another wallet the "default" wallet which can result in lost funds.

@ryanofsky
Copy link
Contributor

Right now, if you are using bitcoin-cli you can specify rpcwallet=wallet.dat in your config file, and you won't have to specify any wallet on the command line. If you are using another RPC client you can send requests to /wallet/wallet.dat instead of /, which might require some work if you have preexisting code, but at least you shouldn't have to change the content of the requests.

For the future, I suggested in #10868 (comment) that we could add a server-side -defaultwallet option, which would let you explicitly specify a default wallet for the server, instead of having it implicitly chose one based on the order options were parsed (and no way to prevent it if you don't want a default wallet). Rebasing #10615 and adding per-user default or restricted wallets could be another option.

@promag
Copy link
Contributor

promag commented Aug 4, 2017

Unless a new option is added to allow backward compatibility? For instance, -defaultwallet=...?

Edit: ops @ryanofsky, you said the same above :)

@jnewbery
Copy link
Contributor

jnewbery commented Aug 4, 2017

NACK for the reasons other people have already mentioned:

  • multiwallet is a new feature so backwards-compatibility is not an issue
  • having an implicit default wallet in multiwallet is a footgun. Perhaps a future change could add an explicit default wallet as @ryanofsky suggests.

@luke-jr
Copy link
Member Author

luke-jr commented Aug 4, 2017

That multiwallet is a new feature doesn't make backward compatibility a non-issue. Just because someone enables new feature XYZ doesn't mean existing features should suddenly break completely.

@sipa
Copy link
Member

sipa commented Aug 4, 2017

No existing functionality is broken. As long as you only have a single wallet, everything keeps working as it was. Once you use multiple wallets - something that didn't exist before - some things stop working because of safety reasons.

Please stop arguing that this is about backward compatibility, it isn't. There are several ideas about how to accomplish your goal (having wallets loaded in the background with a primary one that RPC operates on). Focus on enabling those features that don't risk people shooting themselves in the foot.

@jonasschnelli
Copy link
Contributor

Closing due to the NACK & comments above.

@bitcoin bitcoin locked as resolved and limited conversation to collaborators Sep 8, 2021
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.

6 participants