Allow wallet files in multiple directories

Remove requirement that two wallet files can only be opened at the same time if
they are contained in the same directory.

This change mostly consists of updates to function signatures (updating
functions to take fs::path arguments, instead of combinations of strings,
fs::path, and CDBEnv / CWalletDBWrapper arguments).
This commit is contained in:
Russell Yanofsky
2017-11-13 21:25:46 -05:00
parent 6012f1caf7
commit d8a99f65e5
13 changed files with 201 additions and 151 deletions

View File

@@ -6,26 +6,21 @@
#include <rpc/server.h>
#include <wallet/db.h>
#include <wallet/wallet.h>
WalletTestingSetup::WalletTestingSetup(const std::string& chainName):
TestingSetup(chainName)
TestingSetup(chainName), m_wallet("mock", CWalletDBWrapper::CreateMock())
{
bitdb.MakeMock();
bool fFirstRun;
g_address_type = OUTPUT_TYPE_DEFAULT;
g_change_type = OUTPUT_TYPE_DEFAULT;
std::unique_ptr<CWalletDBWrapper> dbw(new CWalletDBWrapper(&bitdb, "wallet_test.dat"));
pwalletMain = MakeUnique<CWallet>(std::move(dbw));
pwalletMain->LoadWallet(fFirstRun);
RegisterValidationInterface(pwalletMain.get());
m_wallet.LoadWallet(fFirstRun);
RegisterValidationInterface(&m_wallet);
RegisterWalletRPCCommands(tableRPC);
}
WalletTestingSetup::~WalletTestingSetup()
{
UnregisterValidationInterface(pwalletMain.get());
bitdb.Flush(true);
bitdb.Reset();
UnregisterValidationInterface(&m_wallet);
}