mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-03-16 04:32:39 +01:00
wallet: Postpone NotifyWalletLoaded() for encrypted wallets
Too early NotifyWalletLoaded() call in CWallet::Create() results the
notification goes before DescriptorScriptPubKeyMans were created and
added to an encrypted wallet.
Co-authored-by: Andrew Chow <achow101-github@achow101.com>
Github-Pull: bitcoin/bitcoin#24711
Rebased-From: 0c12f0116c
This commit is contained in:
parent
4f3ba8517a
commit
1448c99380
3 changed files with 7 additions and 2 deletions
src/wallet
|
@ -127,6 +127,8 @@ bool LoadWallets(WalletContext& context)
|
||||||
chain.initError(error);
|
chain.initError(error);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NotifyWalletLoaded(context, pwallet);
|
||||||
AddWallet(context, pwallet);
|
AddWallet(context, pwallet);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -54,6 +54,7 @@ static const std::shared_ptr<CWallet> TestLoadWallet(WalletContext& context)
|
||||||
std::vector<bilingual_str> warnings;
|
std::vector<bilingual_str> warnings;
|
||||||
auto database = MakeWalletDatabase("", options, status, error);
|
auto database = MakeWalletDatabase("", options, status, error);
|
||||||
auto wallet = CWallet::Create(context, "", std::move(database), options.create_flags, error, warnings);
|
auto wallet = CWallet::Create(context, "", std::move(database), options.create_flags, error, warnings);
|
||||||
|
NotifyWalletLoaded(context, wallet);
|
||||||
if (context.chain) {
|
if (context.chain) {
|
||||||
wallet->postInitProcess();
|
wallet->postInitProcess();
|
||||||
}
|
}
|
||||||
|
|
|
@ -240,6 +240,8 @@ std::shared_ptr<CWallet> LoadWalletInternal(WalletContext& context, const std::s
|
||||||
status = DatabaseStatus::FAILED_LOAD;
|
status = DatabaseStatus::FAILED_LOAD;
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NotifyWalletLoaded(context, wallet);
|
||||||
AddWallet(context, wallet);
|
AddWallet(context, wallet);
|
||||||
wallet->postInitProcess();
|
wallet->postInitProcess();
|
||||||
|
|
||||||
|
@ -356,6 +358,8 @@ std::shared_ptr<CWallet> CreateWallet(WalletContext& context, const std::string&
|
||||||
wallet->Lock();
|
wallet->Lock();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NotifyWalletLoaded(context, wallet);
|
||||||
AddWallet(context, wallet);
|
AddWallet(context, wallet);
|
||||||
wallet->postInitProcess();
|
wallet->postInitProcess();
|
||||||
|
|
||||||
|
@ -2906,8 +2910,6 @@ std::shared_ptr<CWallet> CWallet::Create(WalletContext& context, const std::stri
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
NotifyWalletLoaded(context, walletInstance);
|
|
||||||
|
|
||||||
{
|
{
|
||||||
LOCK(walletInstance->cs_wallet);
|
LOCK(walletInstance->cs_wallet);
|
||||||
walletInstance->SetBroadcastTransactions(args.GetBoolArg("-walletbroadcast", DEFAULT_WALLETBROADCAST));
|
walletInstance->SetBroadcastTransactions(args.GetBoolArg("-walletbroadcast", DEFAULT_WALLETBROADCAST));
|
||||||
|
|
Loading…
Add table
Reference in a new issue