RPC: Restore backward compatibility, in multiwallet mode #10989

pull luke-jr wants to merge 1 commits into bitcoin:master from luke-jr:multiwallet_rpccompat changing 2 files +5 −5
  1. luke-jr commented at 6:54 PM on August 4, 2017: member

    Appears to have been broken by #10849

  2. RPC: Restore backward compatibility, in multiwallet mode dde71965a8
  3. ryanofsky commented at 7:11 PM on August 4, 2017: member

    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.

  4. jonasschnelli commented at 7:12 PM on August 4, 2017: contributor

    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.

  5. jonasschnelli added the label Wallet on Aug 4, 2017
  6. sipa commented at 7:14 PM on August 4, 2017: member

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

  7. ryanofsky commented at 7:21 PM on August 4, 2017: member

    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.

  8. luke-jr commented at 8:00 PM on August 4, 2017: member

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

  9. jonasschnelli commented at 8:08 PM on August 4, 2017: 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.

  10. ryanofsky commented at 8:57 PM on August 4, 2017: member

    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.

  11. promag commented at 9:39 PM on August 4, 2017: member

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

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

  12. jnewbery commented at 9:59 PM on August 4, 2017: member

    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.
  13. luke-jr commented at 10:12 PM on August 4, 2017: member

    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.

  14. sipa commented at 10:18 PM on August 4, 2017: member

    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.

  15. jonasschnelli commented at 7:27 PM on August 15, 2017: contributor

    Closing due to the NACK & comments above.

  16. jonasschnelli closed this on Aug 15, 2017

  17. DrahtBot locked this on Sep 8, 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-14 15:15 UTC

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