Basic multiwallet support #8694

Open
wants to merge 16 commits into
from

Projects

In progress in Multiwallet support

5 participants

@luke-jr
Member
luke-jr commented Sep 9, 2016 edited

This allows running with multiple -wallet options to load more than one wallet.

GUI has independent comboboxen for the main GUI window and debug console to select which wallet to view/use. The comboboxes are not visible in the main GUI unless multiple wallets are loaded (the debug window's combobox is useful even for a single wallet, since it allows selecting "(none)" to block wallet access).

RPC can access only one wallet per user, but rpcauth is extended to accept a 4th field which controls which wallet, if any, the user has access to. I chose to do it this way because pre-multiwallet nodes will gracefully ignore such rpcauth rather than expose their wallet. The field can also be a single hyphen to block wallet access.

@MarcoFalke MarcoFalke added the Wallet label Sep 9, 2016
@jonasschnelli
Member

Impressive changeset!
General Concept ACK.

Instead of the extending the RPC auth, I could imaging using different RPC endpoints would also work.

  • Accessing RPC at / would result in the default wallet.
  • Accessing RPC at /<walletid> would result in using the wallet with the id <walletid>.

bitcoin-cli could just support a new argument -walletid.
Something like bitcoin-cli -walletid=something getbalance would result in the same RPC call just against the endpoint /something.
Maybe this would result in a simple RPC access to the multiple wallets.

Will review soon.

@luke-jr
Member
luke-jr commented Sep 10, 2016

Instead of the extending the RPC auth, I could imaging using different RPC endpoints would also work.

Indeed, although my main purpose in doing this was to isolate JoinMarket, and it's less isolated if it has auth to my real hotwallet. :)

(Also, endpoints seemed like they'd require more code.)

Accessing RPC at /<walletid> would result in using the wallet with the id <walletid>.

This isn't very future-proof. If we go this route, I'd suggest /?wallet=<walletid>

@btcdrak
Member
btcdrak commented Sep 14, 2016

Nice, Concept ACK. Will test.

@@ -196,8 +196,9 @@ void Shutdown()
StopRPC();
StopHTTPServer();
#ifdef ENABLE_WALLET
- if (pwalletMain)
- pwalletMain->Flush(false);
+ for (CWallet_ptr pwallet : vpwallets) {
@MarcoFalke
MarcoFalke Sep 21, 2016 Member

I like the approach by @jonasschnelli better. Let's keep most of the multiwallet logic in wallet.cpp.

@luke-jr luke-jr added a commit to bitcoinknots/bitcoin that referenced this pull request Oct 20, 2016
@luke-jr luke-jr Wallet: Replace pwalletMain with a vector of wallet pointers
Github-Pull: #8694
Rebased-From: 17480ed9dbd535b174342d02e4a3627ff9ddc193
d6ebde7
@luke-jr luke-jr added a commit to bitcoinknots/bitcoin that referenced this pull request Oct 20, 2016
@luke-jr luke-jr Wallet: Support loading multiple wallets if -wallet used more than once
Github-Pull: #8694
Rebased-From: 03b8a1380e2c91794c5ed4aac0ec50aa85405959
ca93ab2
@luke-jr luke-jr added a commit to bitcoinknots/bitcoin that referenced this pull request Oct 20, 2016
@luke-jr luke-jr Qt: Load all wallets into WalletModels
Github-Pull: #8694
Rebased-From: 4d44a06ee74240a1616b6561767901f3d5e4ad91
aaf1507
@luke-jr luke-jr added a commit to bitcoinknots/bitcoin that referenced this pull request Oct 20, 2016
@luke-jr luke-jr Qt: Add a combobox to toolbar to select from multiple wallets
Github-Pull: #8694
Rebased-From: 6f3f87fe0fcb10929a9a4f367e72767a7b49aa98
b0a256d
@luke-jr luke-jr added a commit to bitcoinknots/bitcoin that referenced this pull request Oct 20, 2016
@luke-jr luke-jr RPC: Allow rpcauth configs to specify a 4th parameter naming a specif…
…ic wallet

Github-Pull: #8694
Rebased-From: df3b6d0
1f62f13
@luke-jr luke-jr added a commit to bitcoinknots/bitcoin that referenced this pull request Oct 20, 2016
@luke-jr luke-jr Qt: Add wallet selector to debug console
Github-Pull: #8694
Rebased-From: 996948a
35fcc1a
@luke-jr luke-jr added a commit to bitcoinknots/bitcoin that referenced this pull request Dec 31, 2016
@luke-jr luke-jr Qt: QComboBox::setVisible doesn't work in toolbars, so defer adding i…
…t at all until needed

Github-Pull: #8694
Rebased-From: d8da183
9f8717c
@luke-jr
Member
luke-jr commented Jan 3, 2017

Rebased, but please prioritise #8775 review (which this is based on) first. Once that's merged, it may or may not make sense to split the Qt changes out of this.

@gmaxwell
Member
gmaxwell commented Jan 7, 2017 edited

Concept ACK.

Syntax for the auth field should have a clear way to extend it to support a list of wallets (first being the default, I guess). I think. To support things like the path selected wallets suggested above later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment