mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-12-03 17:30:25 +01:00
Merge #19619: Remove wallet.dat path handling from wallet.cpp, rpcwallet.cpp
7bf6dfbb48wallet: Remove path checking code from bitcoin-wallet tool (Russell Yanofsky)77d5bb72b8wallet: Remove path checking code from createwallet RPC (Russell Yanofsky)a987438e9dwallet: Remove path checking code from loadwallet RPC (Russell Yanofsky)8b5e7297c0refactor: Pass wallet database into CWallet::Create (Russell Yanofsky)3c815cfe54wallet: Remove Verify and IsLoaded methods (Russell Yanofsky)0d94e60625refactor: Use DatabaseStatus and DatabaseOptions types (Russell Yanofsky)b5b414151awallet: Add MakeDatabase function (Russell Yanofsky)288b4ffb6bRemove WalletLocation class (Russell Yanofsky) Pull request description: Get rid of file path handling in wallet application code and move it down to database layer. There is no change in behavior except for some changed error messages. Motivation for this change is to make code more understandable, but also to prepare for adding SQLite support in #19077 so SQLite implementation can be contained at the database layer and wallet loading code does not need to become more complicated. ACKs for top commit: achow101: ACK7bf6dfbb48meshcollider: Code re-review and functional test run ACK7bf6dfbb48Tree-SHA512: 23ad18324c9e8947f0cf88a3734c2e9fb25536b2cb4d552cf5d1a4ade320fbffb73bb2d1b3a99585c11630aa7092e0fcfc2dd4fe65b91e3a54161433a5cd13cb
This commit is contained in:
@@ -514,15 +514,22 @@ public:
|
||||
void setMockTime(int64_t time) override { return SetMockTime(time); }
|
||||
|
||||
//! WalletClient methods
|
||||
std::unique_ptr<Wallet> createWallet(const std::string& name, const SecureString& passphrase, uint64_t wallet_creation_flags, WalletCreationStatus& status, bilingual_str& error, std::vector<bilingual_str>& warnings) override
|
||||
std::unique_ptr<Wallet> createWallet(const std::string& name, const SecureString& passphrase, uint64_t wallet_creation_flags, bilingual_str& error, std::vector<bilingual_str>& warnings) override
|
||||
{
|
||||
std::shared_ptr<CWallet> wallet;
|
||||
status = CreateWallet(*m_context.chain, passphrase, wallet_creation_flags, name, true /* load_on_start */, error, warnings, wallet);
|
||||
return MakeWallet(std::move(wallet));
|
||||
DatabaseOptions options;
|
||||
DatabaseStatus status;
|
||||
options.require_create = true;
|
||||
options.create_flags = wallet_creation_flags;
|
||||
options.create_passphrase = passphrase;
|
||||
return MakeWallet(CreateWallet(*m_context.chain, name, true /* load_on_start */, options, status, error, warnings));
|
||||
}
|
||||
std::unique_ptr<Wallet> loadWallet(const std::string& name, bilingual_str& error, std::vector<bilingual_str>& warnings) override
|
||||
{
|
||||
return MakeWallet(LoadWallet(*m_context.chain, WalletLocation(name), true /* load_on_start */, error, warnings));
|
||||
DatabaseOptions options;
|
||||
DatabaseStatus status;
|
||||
options.require_existing = true;
|
||||
return MakeWallet(LoadWallet(*m_context.chain, name, true /* load_on_start */, options, status, error, warnings));
|
||||
}
|
||||
std::string getWalletDir() override
|
||||
{
|
||||
|
||||
@@ -29,7 +29,6 @@ class CWallet;
|
||||
enum class FeeReason;
|
||||
enum class OutputType;
|
||||
enum class TransactionError;
|
||||
enum class WalletCreationStatus;
|
||||
enum isminetype : unsigned int;
|
||||
struct CRecipient;
|
||||
struct PartiallySignedTransaction;
|
||||
@@ -311,7 +310,7 @@ class WalletClient : public ChainClient
|
||||
{
|
||||
public:
|
||||
//! Create new wallet.
|
||||
virtual std::unique_ptr<Wallet> createWallet(const std::string& name, const SecureString& passphrase, uint64_t wallet_creation_flags, WalletCreationStatus& status, bilingual_str& error, std::vector<bilingual_str>& warnings) = 0;
|
||||
virtual std::unique_ptr<Wallet> createWallet(const std::string& name, const SecureString& passphrase, uint64_t wallet_creation_flags, bilingual_str& error, std::vector<bilingual_str>& warnings) = 0;
|
||||
|
||||
//! Load existing wallet.
|
||||
virtual std::unique_ptr<Wallet> loadWallet(const std::string& name, bilingual_str& error, std::vector<bilingual_str>& warnings) = 0;
|
||||
|
||||
Reference in New Issue
Block a user