Add Create*WalletDatabase functions
These functions doing the same things as WalletDatabase::Create, CreateMock, and CreateDummy
This commit is contained in:
parent
39bd9ddb87
commit
45c08f8a7b
2 changed files with 28 additions and 0 deletions
|
@ -1023,3 +1023,22 @@ bool IsWalletLoaded(const fs::path& wallet_path)
|
|||
{
|
||||
return IsBDBWalletLoaded(wallet_path);
|
||||
}
|
||||
|
||||
/** Return object for accessing database at specified path. */
|
||||
std::unique_ptr<BerkeleyDatabase> CreateWalletDatabase(const fs::path& path)
|
||||
{
|
||||
std::string filename;
|
||||
return MakeUnique<BerkeleyDatabase>(GetWalletEnv(path, filename), std::move(filename));
|
||||
}
|
||||
|
||||
/** Return object for accessing dummy database with no read/write capabilities. */
|
||||
std::unique_ptr<BerkeleyDatabase> CreateDummyWalletDatabase()
|
||||
{
|
||||
return MakeUnique<BerkeleyDatabase>();
|
||||
}
|
||||
|
||||
/** Return object for accessing temporary in-memory database. */
|
||||
std::unique_ptr<BerkeleyDatabase> CreateMockWalletDatabase()
|
||||
{
|
||||
return MakeUnique<BerkeleyDatabase>(std::make_shared<BerkeleyEnvironment>(), "");
|
||||
}
|
||||
|
|
|
@ -293,4 +293,13 @@ bool ReadKeyValue(CWallet* pwallet, CDataStream& ssKey, CDataStream& ssValue, st
|
|||
/** Return whether a wallet database is currently loaded. */
|
||||
bool IsWalletLoaded(const fs::path& wallet_path);
|
||||
|
||||
/** Return object for accessing database at specified path. */
|
||||
std::unique_ptr<BerkeleyDatabase> CreateWalletDatabase(const fs::path& path);
|
||||
|
||||
/** Return object for accessing dummy database with no read/write capabilities. */
|
||||
std::unique_ptr<BerkeleyDatabase> CreateDummyWalletDatabase();
|
||||
|
||||
/** Return object for accessing temporary in-memory database. */
|
||||
std::unique_ptr<BerkeleyDatabase> CreateMockWalletDatabase();
|
||||
|
||||
#endif // BITCOIN_WALLET_WALLETDB_H
|
||||
|
|
Loading…
Reference in a new issue