mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-10-28 06:28:41 +01:00
Fixes for 'std::bad_alloc' issue.
This commit is contained in:
@@ -294,14 +294,26 @@ extern "C"
|
||||
return true;
|
||||
}
|
||||
|
||||
void load_wallet(char *path, char *password, int32_t nettype)
|
||||
bool load_wallet(char *path, char *password, int32_t nettype)
|
||||
{
|
||||
nice(19);
|
||||
Monero::NetworkType networkType = static_cast<Monero::NetworkType>(nettype);
|
||||
Monero::Wallet *wallet = Monero::WalletManagerFactory::getWalletManager()->openWallet(std::string(path), std::string(password), networkType);
|
||||
Monero::WalletManager *walletManager = Monero::WalletManagerFactory::getWalletManager();
|
||||
Monero::Wallet *wallet = walletManager->openWallet(std::string(path), std::string(password), networkType);
|
||||
int status;
|
||||
std::string errorString;
|
||||
|
||||
wallet->statusWithErrorString(status, errorString);
|
||||
change_current_wallet(wallet);
|
||||
|
||||
return !(status != Monero::Wallet::Status_Ok || !errorString.empty());
|
||||
}
|
||||
|
||||
char *error_string() {
|
||||
return strdup(get_current_wallet()->errorString().c_str());
|
||||
}
|
||||
|
||||
|
||||
bool is_wallet_exist(char *path)
|
||||
{
|
||||
return Monero::WalletManagerFactory::getWalletManager()->walletExists(std::string(path));
|
||||
|
||||
Reference in New Issue
Block a user