Skip to content

Multiwallet qt#2184

Closed
CodeShark wants to merge 39 commits intobitcoin:masterfrom
CodeShark:multiwallet-qt
Closed

Multiwallet qt#2184
CodeShark wants to merge 39 commits intobitcoin:masterfrom
CodeShark:multiwallet-qt

Conversation

@CodeShark
Copy link
Contributor

Added ability to load/unload multiple wallets dynamically in bitcoin-qt

=============================

A new global structure called pWalletMap has been added. Upon initialization, multiple wallets can be loaded.

A new CWallet* parameter has been added to the RPC functions. Functions which do not use a wallet simply ignore it. In addition, a new field has been added to CRPCCommand that tells us whether or not the function uses a wallet.

Two new RPC methods have been added:
  1) listwallets - Returns an array containing wallet names.
  2) usewallet - Prefix existing wallet RPC calls with usewallet <walletname> to use a particular wallet. If no wallet is specified, the default wallet is used.
    example: bitcoind usewallet foo listreceivedbyaddress 0 true

TODO:
  1) Get wallet names from bitcoin.conf in init.cpp.
  2) Change help RPC so that the message does not depend on wallet state (i.e. walletpassphrase RPC call)
=================================================================

You can now specify additional wallets in the config file or via command line arguments:

	usewallet=foo

or

	bitcoind -usewallet=foo

A default wallet called "default" in the RPC and using file "wallet.dat" is always loaded, as to not break compatibility with the master branch. Therefore, additional wallets should neither be called "default" nor "wallet" nor anything else that might conflict with other filenames in the .bitcoin directory.

The wallet will be stored in a file called foo.dat. If the wallet doesn't yet exist, it will be created the first time bitcoind is run.

TODO: Ensure filename collisions cannot occur. Perhaps allow the wallet files to be arbitrarily named rather than tied to their identifier.
…ons are synched automatically without having to call SyncWithWallets() explicitly. This is important when sending between two wallets in a single bitcoind instance so that the receiving wallet is alerted of the transaction immediately.

Removed calls to SyncWithWallets() in ProcessMessage() since SyncWithWallets() is already called by tx.AcceptToMemoryPool().

SyncWithWallets() is still called explicitly from CBlock::ConnectBlock() since the transaction never goes through the mempool in this case.
… methods. Help always returns usage info now.
…ets. getinfo now just shows how many wallets are loaded.
…rpcwallet.cpp into CCryptoKeyStore class.

TODO:
  Encapsulate the thread spawning and make the call nonblocking.
  Give each thread a unique name.
New Changes:
  - Moved LoadWallet out of init.cpp and into CWalletMap class.
  - Added new RPC methods: loadwallet and unloadwallet.

TODO:
  - Clean up I/O in CWalletMap::LoadWallet - debug, error, and UI output functions.
  - Make sure wallet loading and unloading are thread-safe.
  - Save wallets to bitcoin.conf automatically.
…tMap now handles unregistration of wallets from main.

Added linker option to makefiles for boost_regex.
If at least one -usewallet parameter is given, it will use those parameters to determine which wallets to load at startup.
If no -usewallet parameters are given, it searches the data directory for files named wallet-<walletname>.dat.

Also added -nousewallet parameters which override either -usewallet or the data directory.
… to within the class methods themselves and out of bitcoinrpc.cpp, wallet unload locks on individual wallet rather than all wallets.
… rather than iterating through the wallet map in init.
@laanwj
Copy link
Member

laanwj commented Jan 16, 2013

Nice!

It's a huge pull request though; will take some time to look at it.

BTW: seems there is a merge problem?

Copy link

Choose a reason for hiding this comment

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

Not needed anymore.

@CodeShark
Copy link
Contributor Author

The merge is actually not that horrible...

@BitcoinPullTester
Copy link

Automatic sanity-testing: PASSED, see http://jenkins.bluematt.me/pull-tester/227637f431b1994d0d87b66993129fd4a1e0a0e1 for binaries and test log.

@BitcoinPullTester
Copy link

Automatic sanity-testing: FAILED MERGE, see http://jenkins.bluematt.me/pull-tester/18ad19fbde0688645f52e26ae545da2849d7c9b4 for test log.

This pull does not merge cleanly onto current master
This test script verifies pulls every time they are updated. It, however, dies sometimes and fails to test properly. If you are waiting on a test, please check timestamps to verify that the test.log is moving at http://jenkins.bluematt.me/pull-tester/current/
Contact BlueMatt on freenode if something looks broken.

@Diapolo
Copy link

Diapolo commented Sep 17, 2013

Needs a rebase to keep up with autotools.

@CodeShark
Copy link
Contributor Author

Actually, I accidentally pushed this - I am no longer supporting this branch and will close the pull request.

@CodeShark CodeShark closed this Sep 17, 2013
@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

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants