Skip to content

Commit

Permalink
fix loadwallet created from navio-wallet
Browse files Browse the repository at this point in the history
  • Loading branch information
alex v committed Sep 22, 2024
1 parent 524d402 commit 5d905a3
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/wallet/rpc/addresses.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ RPCHelpMan getnewaddress()

LOCK(pwallet->cs_wallet);

if (!pwallet->CanGetAddresses()) {
if ((!pwallet->IsWalletFlagSet(WALLET_FLAG_BLSCT) && !pwallet->CanGetAddresses()) || (pwallet->IsWalletFlagSet(WALLET_FLAG_BLSCT) && !pwallet->GetOrCreateBLSCTKeyMan()->CanGenerateKeys())) {
throw JSONRPCError(RPC_WALLET_ERROR, "Error: This wallet has no available keys");
}

Expand Down
3 changes: 2 additions & 1 deletion src/wallet/wallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2971,6 +2971,7 @@ std::shared_ptr<CWallet> CWallet::Create(WalletContext& context, const std::stri
// Load wallet
bool rescan_required = false;
DBErrors nLoadWalletRet = walletInstance->LoadWallet();

if (nLoadWalletRet != DBErrors::LOAD_OK) {
if (nLoadWalletRet == DBErrors::CORRUPT) {
error = strprintf(_("Error loading %s: Wallet corrupted"), walletFile);
Expand Down Expand Up @@ -3012,7 +3013,7 @@ std::shared_ptr<CWallet> CWallet::Create(WalletContext& context, const std::stri
}

// This wallet is in its first run if there are no ScriptPubKeyMans and it isn't blank or no privkeys
const bool fFirstRun = walletInstance->m_spk_managers.empty() &&
const bool fFirstRun = ((walletInstance->m_spk_managers.empty() && !walletInstance->IsWalletFlagSet(WALLET_FLAG_BLSCT)) || !walletInstance->GetOrCreateBLSCTKeyMan()->CanGenerateKeys()) &&
!walletInstance->IsWalletFlagSet(WALLET_FLAG_DISABLE_PRIVATE_KEYS) &&
!walletInstance->IsWalletFlagSet(WALLET_FLAG_BLANK_WALLET);
if (fFirstRun) {
Expand Down
1 change: 0 additions & 1 deletion src/wallet/wallettool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ static void WalletToolReleaseWallet(CWallet* wallet)
static void WalletCreate(CWallet* wallet_instance, uint64_t wallet_creation_flags, const std::vector<unsigned char>& seed, const blsct::SeedType& type)
{
LOCK(wallet_instance->cs_wallet);

wallet_instance->SetMinVersion(FEATURE_LATEST);
wallet_instance->InitWalletFlags(wallet_creation_flags);

Expand Down

0 comments on commit 5d905a3

Please sign in to comment.