mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-03-26 15:36:19 +01:00
wallet: Handle duplicate fileid exception
This commit is contained in:
@@ -148,19 +148,24 @@ void UnloadWallet(std::shared_ptr<CWallet>&& wallet)
|
||||
|
||||
std::shared_ptr<CWallet> LoadWallet(interfaces::Chain& chain, const WalletLocation& location, std::string& error, std::vector<std::string>& warnings)
|
||||
{
|
||||
if (!CWallet::Verify(chain, location, false, error, warnings)) {
|
||||
error = "Wallet file verification failed: " + error;
|
||||
return nullptr;
|
||||
}
|
||||
try {
|
||||
if (!CWallet::Verify(chain, location, false, error, warnings)) {
|
||||
error = "Wallet file verification failed: " + error;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
std::shared_ptr<CWallet> wallet = CWallet::CreateWalletFromFile(chain, location, error, warnings);
|
||||
if (!wallet) {
|
||||
error = "Wallet loading failed: " + error;
|
||||
std::shared_ptr<CWallet> wallet = CWallet::CreateWalletFromFile(chain, location, error, warnings);
|
||||
if (!wallet) {
|
||||
error = "Wallet loading failed: " + error;
|
||||
return nullptr;
|
||||
}
|
||||
AddWallet(wallet);
|
||||
wallet->postInitProcess();
|
||||
return wallet;
|
||||
} catch (const std::runtime_error& e) {
|
||||
error = e.what();
|
||||
return nullptr;
|
||||
}
|
||||
AddWallet(wallet);
|
||||
wallet->postInitProcess();
|
||||
return wallet;
|
||||
}
|
||||
|
||||
std::shared_ptr<CWallet> LoadWallet(interfaces::Chain& chain, const std::string& name, std::string& error, std::vector<std::string>& warnings)
|
||||
|
||||
Reference in New Issue
Block a user