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

Basic multiwallet support #8694

Merged
merged 13 commits into from Jun 12, 2017
Merged

Basic multiwallet support #8694

merged 13 commits into from Jun 12, 2017

Conversation

luke-jr
Copy link
Member

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

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.

(RPC and GUI changes are moved to my multiwallet_rpc and multiwallet_gui branches)

@jonasschnelli
Copy link
Contributor

jonasschnelli commented Sep 10, 2016

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
Copy link
Member Author

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
Copy link
Contributor

btcdrak commented Sep 14, 2016

Nice, Concept ACK. Will test.

src/init.cpp Outdated
@@ -196,8 +196,9 @@ void Shutdown()
StopRPC();
StopHTTPServer();
#ifdef ENABLE_WALLET
if (pwalletMain)
pwalletMain->Flush(false);
for (CWallet_ptr pwallet : vpwallets) {
Copy link
Member

@MarcoFalke MarcoFalke Sep 21, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Member Author

@luke-jr luke-jr Mar 3, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not in wallet.cpp now. Moving it there seems like a good idea, but independent of this PR...

luke-jr added a commit to bitcoinknots/bitcoin that referenced this pull request Oct 20, 2016
Github-Pull: bitcoin#8694
Rebased-From: 17480ed9dbd535b174342d02e4a3627ff9ddc193
luke-jr added a commit to bitcoinknots/bitcoin that referenced this pull request Oct 20, 2016
Github-Pull: bitcoin#8694
Rebased-From: 03b8a1380e2c91794c5ed4aac0ec50aa85405959
luke-jr added a commit to bitcoinknots/bitcoin that referenced this pull request Oct 20, 2016
Github-Pull: bitcoin#8694
Rebased-From: 4d44a06ee74240a1616b6561767901f3d5e4ad91
luke-jr added a commit to bitcoinknots/bitcoin that referenced this pull request Oct 20, 2016
Github-Pull: bitcoin#8694
Rebased-From: 6f3f87fe0fcb10929a9a4f367e72767a7b49aa98
luke-jr added a commit to bitcoinknots/bitcoin that referenced this pull request Oct 20, 2016
…ic wallet

Github-Pull: bitcoin#8694
Rebased-From: df3b6d0c2b386a89497b751a0c182d32463cef06
luke-jr added a commit to bitcoinknots/bitcoin that referenced this pull request Oct 20, 2016
Github-Pull: bitcoin#8694
Rebased-From: 996948af12b418562cbc2d29c1d7f9d8b9ca2a46
luke-jr added a commit to bitcoinknots/bitcoin that referenced this pull request Dec 31, 2016
…t at all until needed

Github-Pull: bitcoin#8694
Rebased-From: d8da1836ed8face673decf20312bc1aa0c718aae
@luke-jr
Copy link
Member Author

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
Copy link
Contributor

gmaxwell commented Jan 7, 2017

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.

@luke-jr
Copy link
Member Author

luke-jr commented Feb 3, 2017

Moved RPC/GUI changes out of this, and rebased.

luke-jr added a commit to bitcoinknots/bitcoin that referenced this pull request Jun 15, 2017
luke-jr added a commit to bitcoinknots/bitcoin that referenced this pull request Jun 15, 2017
luke-jr added a commit to bitcoinknots/bitcoin that referenced this pull request Jun 15, 2017
luke-jr added a commit to bitcoinknots/bitcoin that referenced this pull request Jun 15, 2017
luke-jr added a commit to bitcoinknots/bitcoin that referenced this pull request Jun 15, 2017
laanwj added a commit that referenced this pull request Jul 21, 2017
…me in `getwalletinfo` and add multiwallet test

3707fcd [wallet] [tests] Add listwallets to multiwallet test (John Newbery)
9508761 [wallet] [rpc] Add listwallets RPC (John Newbery)
4a05715 [wallet] [rpc] print wallet name in getwalletinfo (John Newbery)
09eacee [wallet] fix comment for CWallet::Verify() (John Newbery)

Pull request description:

  - fix comment for CWallet::Verify (cleanup after #8694)
  - expose the wallet name in `getwalletinfo` rpc
  - add `listwallets` rpc - returns array of wallet names
  - add functional test for multiwallet using new rpc functionality

Tree-SHA512: 52f864726bf8a28421d4f3604a6cb95fffb3f4e19edbce18efaef06142c48dd4adb9e7a65a10de2955c80f13c00803ce27c78ccbc8434d92ef12cd36c4ccb4aa
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jul 5, 2019
c237bd7 wallet: Update formatting (Luke Dashjr)
9cbe8c8 wallet: Forbid -salvagewallet, -zapwallettxes, and -upgradewallet with multiple wallets (Luke Dashjr)
a2a5f3f wallet: Base backup filenames on original wallet filename (Luke Dashjr)
b823a4c wallet: Include actual backup filename in recovery warning message (Luke Dashjr)
84dcb45 Bugfix: wallet: Fix warningStr, errorStr argument order (Luke Dashjr)
008c360 Wallet: Move multiwallet sanity checks to CWallet::Verify, and do other checks on all wallets (Luke Dashjr)
0f08575 Wallet: Support loading multiple wallets if -wallet used more than once (Luke Dashjr)
b124cf0 Wallet: Replace pwalletMain with a vector of wallet pointers (Luke Dashjr)
19b3648 CWalletDB: Store the update counter per wallet (Luke Dashjr)
74e8738 Bugfix: ForceSetArg should replace entr(ies) in mapMultiArgs, not append (Luke Dashjr)
23fb9ad wallet: Move nAccountingEntryNumber from static/global to CWallet (Luke Dashjr)
9d15d55 Bugfix: wallet: Increment "update counter" when modifying account stuff (Luke Dashjr)
f28eb80 Bugfix: wallet: Increment "update counter" only after actually making the applicable db changes to avoid potential races (Luke Dashjr)

Tree-SHA512: 23f5dda58477307bc07997010740f1dc729164cdddefd2f9a2c9c7a877111eb1516d3e2ad4f9b104621f0b7f17369c69fcef13d28b85cb6c01d35f09a8845f23
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jul 5, 2019
c237bd7 wallet: Update formatting (Luke Dashjr)
9cbe8c8 wallet: Forbid -salvagewallet, -zapwallettxes, and -upgradewallet with multiple wallets (Luke Dashjr)
a2a5f3f wallet: Base backup filenames on original wallet filename (Luke Dashjr)
b823a4c wallet: Include actual backup filename in recovery warning message (Luke Dashjr)
84dcb45 Bugfix: wallet: Fix warningStr, errorStr argument order (Luke Dashjr)
008c360 Wallet: Move multiwallet sanity checks to CWallet::Verify, and do other checks on all wallets (Luke Dashjr)
0f08575 Wallet: Support loading multiple wallets if -wallet used more than once (Luke Dashjr)
b124cf0 Wallet: Replace pwalletMain with a vector of wallet pointers (Luke Dashjr)
19b3648 CWalletDB: Store the update counter per wallet (Luke Dashjr)
74e8738 Bugfix: ForceSetArg should replace entr(ies) in mapMultiArgs, not append (Luke Dashjr)
23fb9ad wallet: Move nAccountingEntryNumber from static/global to CWallet (Luke Dashjr)
9d15d55 Bugfix: wallet: Increment "update counter" when modifying account stuff (Luke Dashjr)
f28eb80 Bugfix: wallet: Increment "update counter" only after actually making the applicable db changes to avoid potential races (Luke Dashjr)

Tree-SHA512: 23f5dda58477307bc07997010740f1dc729164cdddefd2f9a2c9c7a877111eb1516d3e2ad4f9b104621f0b7f17369c69fcef13d28b85cb6c01d35f09a8845f23
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jul 6, 2019
c237bd7 wallet: Update formatting (Luke Dashjr)
9cbe8c8 wallet: Forbid -salvagewallet, -zapwallettxes, and -upgradewallet with multiple wallets (Luke Dashjr)
a2a5f3f wallet: Base backup filenames on original wallet filename (Luke Dashjr)
b823a4c wallet: Include actual backup filename in recovery warning message (Luke Dashjr)
84dcb45 Bugfix: wallet: Fix warningStr, errorStr argument order (Luke Dashjr)
008c360 Wallet: Move multiwallet sanity checks to CWallet::Verify, and do other checks on all wallets (Luke Dashjr)
0f08575 Wallet: Support loading multiple wallets if -wallet used more than once (Luke Dashjr)
b124cf0 Wallet: Replace pwalletMain with a vector of wallet pointers (Luke Dashjr)
19b3648 CWalletDB: Store the update counter per wallet (Luke Dashjr)
74e8738 Bugfix: ForceSetArg should replace entr(ies) in mapMultiArgs, not append (Luke Dashjr)
23fb9ad wallet: Move nAccountingEntryNumber from static/global to CWallet (Luke Dashjr)
9d15d55 Bugfix: wallet: Increment "update counter" when modifying account stuff (Luke Dashjr)
f28eb80 Bugfix: wallet: Increment "update counter" only after actually making the applicable db changes to avoid potential races (Luke Dashjr)

Tree-SHA512: 23f5dda58477307bc07997010740f1dc729164cdddefd2f9a2c9c7a877111eb1516d3e2ad4f9b104621f0b7f17369c69fcef13d28b85cb6c01d35f09a8845f23
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jul 8, 2019
c237bd7 wallet: Update formatting (Luke Dashjr)
9cbe8c8 wallet: Forbid -salvagewallet, -zapwallettxes, and -upgradewallet with multiple wallets (Luke Dashjr)
a2a5f3f wallet: Base backup filenames on original wallet filename (Luke Dashjr)
b823a4c wallet: Include actual backup filename in recovery warning message (Luke Dashjr)
84dcb45 Bugfix: wallet: Fix warningStr, errorStr argument order (Luke Dashjr)
008c360 Wallet: Move multiwallet sanity checks to CWallet::Verify, and do other checks on all wallets (Luke Dashjr)
0f08575 Wallet: Support loading multiple wallets if -wallet used more than once (Luke Dashjr)
b124cf0 Wallet: Replace pwalletMain with a vector of wallet pointers (Luke Dashjr)
19b3648 CWalletDB: Store the update counter per wallet (Luke Dashjr)
74e8738 Bugfix: ForceSetArg should replace entr(ies) in mapMultiArgs, not append (Luke Dashjr)
23fb9ad wallet: Move nAccountingEntryNumber from static/global to CWallet (Luke Dashjr)
9d15d55 Bugfix: wallet: Increment "update counter" when modifying account stuff (Luke Dashjr)
f28eb80 Bugfix: wallet: Increment "update counter" only after actually making the applicable db changes to avoid potential races (Luke Dashjr)

Tree-SHA512: 23f5dda58477307bc07997010740f1dc729164cdddefd2f9a2c9c7a877111eb1516d3e2ad4f9b104621f0b7f17369c69fcef13d28b85cb6c01d35f09a8845f23
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jul 8, 2019
c237bd7 wallet: Update formatting (Luke Dashjr)
9cbe8c8 wallet: Forbid -salvagewallet, -zapwallettxes, and -upgradewallet with multiple wallets (Luke Dashjr)
a2a5f3f wallet: Base backup filenames on original wallet filename (Luke Dashjr)
b823a4c wallet: Include actual backup filename in recovery warning message (Luke Dashjr)
84dcb45 Bugfix: wallet: Fix warningStr, errorStr argument order (Luke Dashjr)
008c360 Wallet: Move multiwallet sanity checks to CWallet::Verify, and do other checks on all wallets (Luke Dashjr)
0f08575 Wallet: Support loading multiple wallets if -wallet used more than once (Luke Dashjr)
b124cf0 Wallet: Replace pwalletMain with a vector of wallet pointers (Luke Dashjr)
19b3648 CWalletDB: Store the update counter per wallet (Luke Dashjr)
74e8738 Bugfix: ForceSetArg should replace entr(ies) in mapMultiArgs, not append (Luke Dashjr)
23fb9ad wallet: Move nAccountingEntryNumber from static/global to CWallet (Luke Dashjr)
9d15d55 Bugfix: wallet: Increment "update counter" when modifying account stuff (Luke Dashjr)
f28eb80 Bugfix: wallet: Increment "update counter" only after actually making the applicable db changes to avoid potential races (Luke Dashjr)

Tree-SHA512: 23f5dda58477307bc07997010740f1dc729164cdddefd2f9a2c9c7a877111eb1516d3e2ad4f9b104621f0b7f17369c69fcef13d28b85cb6c01d35f09a8845f23
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jul 9, 2019
c237bd7 wallet: Update formatting (Luke Dashjr)
9cbe8c8 wallet: Forbid -salvagewallet, -zapwallettxes, and -upgradewallet with multiple wallets (Luke Dashjr)
a2a5f3f wallet: Base backup filenames on original wallet filename (Luke Dashjr)
b823a4c wallet: Include actual backup filename in recovery warning message (Luke Dashjr)
84dcb45 Bugfix: wallet: Fix warningStr, errorStr argument order (Luke Dashjr)
008c360 Wallet: Move multiwallet sanity checks to CWallet::Verify, and do other checks on all wallets (Luke Dashjr)
0f08575 Wallet: Support loading multiple wallets if -wallet used more than once (Luke Dashjr)
b124cf0 Wallet: Replace pwalletMain with a vector of wallet pointers (Luke Dashjr)
19b3648 CWalletDB: Store the update counter per wallet (Luke Dashjr)
74e8738 Bugfix: ForceSetArg should replace entr(ies) in mapMultiArgs, not append (Luke Dashjr)
23fb9ad wallet: Move nAccountingEntryNumber from static/global to CWallet (Luke Dashjr)
9d15d55 Bugfix: wallet: Increment "update counter" when modifying account stuff (Luke Dashjr)
f28eb80 Bugfix: wallet: Increment "update counter" only after actually making the applicable db changes to avoid potential races (Luke Dashjr)

Tree-SHA512: 23f5dda58477307bc07997010740f1dc729164cdddefd2f9a2c9c7a877111eb1516d3e2ad4f9b104621f0b7f17369c69fcef13d28b85cb6c01d35f09a8845f23
UdjinM6 pushed a commit to dashpay/dash that referenced this pull request Jul 11, 2019
* Merge bitcoin#8694: Basic multiwallet support

c237bd7 wallet: Update formatting (Luke Dashjr)
9cbe8c8 wallet: Forbid -salvagewallet, -zapwallettxes, and -upgradewallet with multiple wallets (Luke Dashjr)
a2a5f3f wallet: Base backup filenames on original wallet filename (Luke Dashjr)
b823a4c wallet: Include actual backup filename in recovery warning message (Luke Dashjr)
84dcb45 Bugfix: wallet: Fix warningStr, errorStr argument order (Luke Dashjr)
008c360 Wallet: Move multiwallet sanity checks to CWallet::Verify, and do other checks on all wallets (Luke Dashjr)
0f08575 Wallet: Support loading multiple wallets if -wallet used more than once (Luke Dashjr)
b124cf0 Wallet: Replace pwalletMain with a vector of wallet pointers (Luke Dashjr)
19b3648 CWalletDB: Store the update counter per wallet (Luke Dashjr)
74e8738 Bugfix: ForceSetArg should replace entr(ies) in mapMultiArgs, not append (Luke Dashjr)
23fb9ad wallet: Move nAccountingEntryNumber from static/global to CWallet (Luke Dashjr)
9d15d55 Bugfix: wallet: Increment "update counter" when modifying account stuff (Luke Dashjr)
f28eb80 Bugfix: wallet: Increment "update counter" only after actually making the applicable db changes to avoid potential races (Luke Dashjr)

Tree-SHA512: 23f5dda58477307bc07997010740f1dc729164cdddefd2f9a2c9c7a877111eb1516d3e2ad4f9b104621f0b7f17369c69fcef13d28b85cb6c01d35f09a8845f23

* pwalletMain -> vpwallets

Signed-off-by: Pasta <pasta@dashboost.org>

* add gArgs

Signed-off-by: Pasta <pasta@dashboost.org>

* continued pwalletsMain -> vpwallets

Signed-off-by: Pasta <pasta@dashboost.org>

* remove external pwalletMains and pwalletMain -> vpwallet

Signed-off-by: Pasta <pasta@dashboost.org>

* add external referance to vpwallets

Signed-off-by: Pasta <pasta@dashboost.org>

* more pWalletMain -> vpwallets[0]

Signed-off-by: Pasta <pasta@dashboost.org>

* code review

Signed-off-by: Pasta <pasta@dashboost.org>

* revert LOCK(cs_main) move

Signed-off-by: Pasta <pasta@dashboost.org>

* import wallet.h and remove extern

Signed-off-by: Pasta <pasta@dashboost.org>

* batch.* -> WriteIC and EraseIC

Signed-off-by: Pasta <pasta@dashboost.org>

* wrap wallet.h include inside of an ifdef

Signed-off-by: Pasta <pasta@dashboost.org>

* drop wallet.h

Signed-off-by: Pasta <pasta@dashboost.org>

* add dropped "!"

Signed-off-by: Pasta <pasta@dashboost.org>
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Aug 6, 2019
…llet name in `getwalletinfo` and add multiwallet test

3707fcd [wallet] [tests] Add listwallets to multiwallet test (John Newbery)
9508761 [wallet] [rpc] Add listwallets RPC (John Newbery)
4a05715 [wallet] [rpc] print wallet name in getwalletinfo (John Newbery)
09eacee [wallet] fix comment for CWallet::Verify() (John Newbery)

Pull request description:

  - fix comment for CWallet::Verify (cleanup after bitcoin#8694)
  - expose the wallet name in `getwalletinfo` rpc
  - add `listwallets` rpc - returns array of wallet names
  - add functional test for multiwallet using new rpc functionality

Tree-SHA512: 52f864726bf8a28421d4f3604a6cb95fffb3f4e19edbce18efaef06142c48dd4adb9e7a65a10de2955c80f13c00803ce27c78ccbc8434d92ef12cd36c4ccb4aa
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Aug 6, 2019
…llet name in `getwalletinfo` and add multiwallet test

3707fcd [wallet] [tests] Add listwallets to multiwallet test (John Newbery)
9508761 [wallet] [rpc] Add listwallets RPC (John Newbery)
4a05715 [wallet] [rpc] print wallet name in getwalletinfo (John Newbery)
09eacee [wallet] fix comment for CWallet::Verify() (John Newbery)

Pull request description:

  - fix comment for CWallet::Verify (cleanup after bitcoin#8694)
  - expose the wallet name in `getwalletinfo` rpc
  - add `listwallets` rpc - returns array of wallet names
  - add functional test for multiwallet using new rpc functionality

Tree-SHA512: 52f864726bf8a28421d4f3604a6cb95fffb3f4e19edbce18efaef06142c48dd4adb9e7a65a10de2955c80f13c00803ce27c78ccbc8434d92ef12cd36c4ccb4aa
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Aug 6, 2019
…llet name in `getwalletinfo` and add multiwallet test

3707fcd [wallet] [tests] Add listwallets to multiwallet test (John Newbery)
9508761 [wallet] [rpc] Add listwallets RPC (John Newbery)
4a05715 [wallet] [rpc] print wallet name in getwalletinfo (John Newbery)
09eacee [wallet] fix comment for CWallet::Verify() (John Newbery)

Pull request description:

  - fix comment for CWallet::Verify (cleanup after bitcoin#8694)
  - expose the wallet name in `getwalletinfo` rpc
  - add `listwallets` rpc - returns array of wallet names
  - add functional test for multiwallet using new rpc functionality

Tree-SHA512: 52f864726bf8a28421d4f3604a6cb95fffb3f4e19edbce18efaef06142c48dd4adb9e7a65a10de2955c80f13c00803ce27c78ccbc8434d92ef12cd36c4ccb4aa
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Aug 7, 2019
…llet name in `getwalletinfo` and add multiwallet test

3707fcd [wallet] [tests] Add listwallets to multiwallet test (John Newbery)
9508761 [wallet] [rpc] Add listwallets RPC (John Newbery)
4a05715 [wallet] [rpc] print wallet name in getwalletinfo (John Newbery)
09eacee [wallet] fix comment for CWallet::Verify() (John Newbery)

Pull request description:

  - fix comment for CWallet::Verify (cleanup after bitcoin#8694)
  - expose the wallet name in `getwalletinfo` rpc
  - add `listwallets` rpc - returns array of wallet names
  - add functional test for multiwallet using new rpc functionality

Tree-SHA512: 52f864726bf8a28421d4f3604a6cb95fffb3f4e19edbce18efaef06142c48dd4adb9e7a65a10de2955c80f13c00803ce27c78ccbc8434d92ef12cd36c4ccb4aa
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Aug 8, 2019
…llet name in `getwalletinfo` and add multiwallet test

3707fcd [wallet] [tests] Add listwallets to multiwallet test (John Newbery)
9508761 [wallet] [rpc] Add listwallets RPC (John Newbery)
4a05715 [wallet] [rpc] print wallet name in getwalletinfo (John Newbery)
09eacee [wallet] fix comment for CWallet::Verify() (John Newbery)

Pull request description:

  - fix comment for CWallet::Verify (cleanup after bitcoin#8694)
  - expose the wallet name in `getwalletinfo` rpc
  - add `listwallets` rpc - returns array of wallet names
  - add functional test for multiwallet using new rpc functionality

Tree-SHA512: 52f864726bf8a28421d4f3604a6cb95fffb3f4e19edbce18efaef06142c48dd4adb9e7a65a10de2955c80f13c00803ce27c78ccbc8434d92ef12cd36c4ccb4aa
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Aug 12, 2019
…llet name in `getwalletinfo` and add multiwallet test

3707fcd [wallet] [tests] Add listwallets to multiwallet test (John Newbery)
9508761 [wallet] [rpc] Add listwallets RPC (John Newbery)
4a05715 [wallet] [rpc] print wallet name in getwalletinfo (John Newbery)
09eacee [wallet] fix comment for CWallet::Verify() (John Newbery)

Pull request description:

  - fix comment for CWallet::Verify (cleanup after bitcoin#8694)
  - expose the wallet name in `getwalletinfo` rpc
  - add `listwallets` rpc - returns array of wallet names
  - add functional test for multiwallet using new rpc functionality

Tree-SHA512: 52f864726bf8a28421d4f3604a6cb95fffb3f4e19edbce18efaef06142c48dd4adb9e7a65a10de2955c80f13c00803ce27c78ccbc8434d92ef12cd36c4ccb4aa
barrystyle pushed a commit to PACGlobalOfficial/PAC that referenced this pull request Jan 22, 2020
* Merge bitcoin#8694: Basic multiwallet support

c237bd7 wallet: Update formatting (Luke Dashjr)
9cbe8c8 wallet: Forbid -salvagewallet, -zapwallettxes, and -upgradewallet with multiple wallets (Luke Dashjr)
a2a5f3f wallet: Base backup filenames on original wallet filename (Luke Dashjr)
b823a4c wallet: Include actual backup filename in recovery warning message (Luke Dashjr)
84dcb45 Bugfix: wallet: Fix warningStr, errorStr argument order (Luke Dashjr)
008c360 Wallet: Move multiwallet sanity checks to CWallet::Verify, and do other checks on all wallets (Luke Dashjr)
0f08575 Wallet: Support loading multiple wallets if -wallet used more than once (Luke Dashjr)
b124cf0 Wallet: Replace pwalletMain with a vector of wallet pointers (Luke Dashjr)
19b3648 CWalletDB: Store the update counter per wallet (Luke Dashjr)
74e8738 Bugfix: ForceSetArg should replace entr(ies) in mapMultiArgs, not append (Luke Dashjr)
23fb9ad wallet: Move nAccountingEntryNumber from static/global to CWallet (Luke Dashjr)
9d15d55 Bugfix: wallet: Increment "update counter" when modifying account stuff (Luke Dashjr)
f28eb80 Bugfix: wallet: Increment "update counter" only after actually making the applicable db changes to avoid potential races (Luke Dashjr)

Tree-SHA512: 23f5dda58477307bc07997010740f1dc729164cdddefd2f9a2c9c7a877111eb1516d3e2ad4f9b104621f0b7f17369c69fcef13d28b85cb6c01d35f09a8845f23

* pwalletMain -> vpwallets

Signed-off-by: Pasta <pasta@dashboost.org>

* add gArgs

Signed-off-by: Pasta <pasta@dashboost.org>

* continued pwalletsMain -> vpwallets

Signed-off-by: Pasta <pasta@dashboost.org>

* remove external pwalletMains and pwalletMain -> vpwallet

Signed-off-by: Pasta <pasta@dashboost.org>

* add external referance to vpwallets

Signed-off-by: Pasta <pasta@dashboost.org>

* more pWalletMain -> vpwallets[0]

Signed-off-by: Pasta <pasta@dashboost.org>

* code review

Signed-off-by: Pasta <pasta@dashboost.org>

* revert LOCK(cs_main) move

Signed-off-by: Pasta <pasta@dashboost.org>

* import wallet.h and remove extern

Signed-off-by: Pasta <pasta@dashboost.org>

* batch.* -> WriteIC and EraseIC

Signed-off-by: Pasta <pasta@dashboost.org>

* wrap wallet.h include inside of an ifdef

Signed-off-by: Pasta <pasta@dashboost.org>

* drop wallet.h

Signed-off-by: Pasta <pasta@dashboost.org>

* add dropped "!"

Signed-off-by: Pasta <pasta@dashboost.org>
barrystyle pushed a commit to PACGlobalOfficial/PAC that referenced this pull request Jan 22, 2020
…llet name in `getwalletinfo` and add multiwallet test

3707fcd [wallet] [tests] Add listwallets to multiwallet test (John Newbery)
9508761 [wallet] [rpc] Add listwallets RPC (John Newbery)
4a05715 [wallet] [rpc] print wallet name in getwalletinfo (John Newbery)
09eacee [wallet] fix comment for CWallet::Verify() (John Newbery)

Pull request description:

  - fix comment for CWallet::Verify (cleanup after bitcoin#8694)
  - expose the wallet name in `getwalletinfo` rpc
  - add `listwallets` rpc - returns array of wallet names
  - add functional test for multiwallet using new rpc functionality

Tree-SHA512: 52f864726bf8a28421d4f3604a6cb95fffb3f4e19edbce18efaef06142c48dd4adb9e7a65a10de2955c80f13c00803ce27c78ccbc8434d92ef12cd36c4ccb4aa
random-zebra added a commit to PIVX-Project/PIVX that referenced this pull request May 17, 2021
4734a84 [Cleanup][Tests] Fix chainparams-change in librust tests (random-zebra)
ff4cee0 [Trivial] Add wallet filename to backup errors/warning (random-zebra)
dc596f3 [Doc] Add multiwallet section to release notes (random-zebra)
36796f2 [Cleanup] Fix formatting in wallet and walletdb (random-zebra)
b6dbbf3 wallet: Forbid -salvagewallet, -zapwallettxes, and -upgradewallet with multiple wallets (random-zebra)
60f9b4b wallet: Base backup filenames on original wallet filename (Luke Dashjr)
e6efa6b wallet: Include actual backup filename in recovery warning message (Luke Dashjr)
647fbc9 Wallet: Move multiwallet sanity checks to CWallet::Verify, and do other checks on all wallets (Luke Dashjr)
b27dcfe Wallet: Support loading multiple wallets if -wallet used more than once (Luke Dashjr)
d10acd5 [Tests] move pwalletMain to wallet test fixture + use smart pointer (random-zebra)
d6cf608 [Refactor] Remove CWalletDBWrapper::GetUpdateCounter() (random-zebra)
4bbad5c [Wallet] Replace pwalletMain with a vector of wallet pointers (random-zebra)
100d67c Wallet: Sanitise -wallet parameter (Luke Dashjr)
3bfa7d8 Wallet/RPC: Use filename rather than CWallet pointer, for lockwallet RPCRunLater job name (Luke Dashjr)
ca6a62d [MOVE-ONLY] Move wallet RPC declarations to rpcwallet.h (random-zebra)
687c2fd RPC: Pass on JSONRPCRequest metadata (URI/user/etc) for "help" method (Luke Dashjr)
cc965fe Move nWalletUnlockTime to CWallet::nRelockTime, and name timed task unique per CWallet (Luke Dashjr)
22f8507 [Trivial] Rename pwalletMain --> pwallet for local variables in RPC (random-zebra)
325baaa RPC: Do all wallet access through new GetWalletForJSONRPCRequest (random-zebra)
0e21e09 [Cleanup] Remove un-used printAddresses() function in rpcwallet (random-zebra)
a8dd236 RPC/Wallet: Pass CWallet as pointer to helper functions (random-zebra)
fb64bbc [Doc] Remove ThreadFlushWalletDB from developer notes (random-zebra)
dc2e022 [Refactor] fix WalletTestingSetup fixture (random-zebra)
f9d7fe1 refactor: move bdb (bitdb) interaction from init.cpp to wallet.cpp (random-zebra)
9cfb711 CWalletDB: Store the update counter per wallet (Luke Dashjr)
8edb74f Bug: increment counter when writing minversion (random-zebra)
8aa93b9 Bugfix: wallet: Increment "update counter" only after actually making the applicable db changes to avoid potential races (Luke Dashjr)

Pull request description:

  Quite a bit of refactoring to bring us a little closer to upstream in the wallet/walletdb area, introducing basic support for multiple wallets.
  The PIVX client can now be started with more than one `-wallet` argument (either as startup flags, or as multiple lines in pivx.conf). The wallets will be all loaded and kept separated, with individual balances, keys and received transactions.

  Even though only the first wallet will be used in the GUI/RPC for the moment (selectable wallets will be added later), all other loaded wallets will remain synchronized to the node's current tip and update their internal data.

  Bulk of changes coming from:
  - bitcoin#8775 RPC refactoring: Access wallet using new GetWalletForJSONRPCRequest
  - bitcoin#8694 Basic multiwallet support
  - bitcoin#11713 Fix for mismatched extern definition in wallet tests
  - bitcoin#11781 tests: move pwalletMain to wallet test fixture

ACKs for top commit:
  furszy:
    Code ACK 4734a84 after rebase and inclusion of 4734a84.

Tree-SHA512: 483fc34310c86070ffde08487605b25da957e55fbc8ef1b9cc1f682c6af0789619bb40839e915618d603097a1bdcf6b2110c7fabf017f8351b3a426976ca77a9
@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
No open projects
Development

Successfully merging this pull request may close these issues.

None yet