diff options
author | furszy <matiasfurszyfer@protonmail.com> | 2024-08-15 11:08:17 -0300 |
---|---|---|
committer | furszy <matiasfurszyfer@protonmail.com> | 2024-08-15 11:54:13 -0300 |
commit | f550a8e035b4603787273ea250f403f6f0be453f (patch) | |
tree | 2275ae22d6c8b457c1f21ae9e3765153bf2de9b4 /src/wallet | |
parent | 64e736d79efc7201768244fc297084f70c0bebc1 (diff) |
Rename ReleaseWallet to FlushAndDeleteWallet
To better describe the function's behavior.
And add wallet name to logprint.
Diffstat (limited to 'src/wallet')
-rw-r--r-- | src/wallet/wallet.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 09e12d52b9..057fa729d7 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -227,10 +227,10 @@ static std::set<std::string> g_loading_wallet_set GUARDED_BY(g_loading_wallet_mu static std::set<std::string> g_unloading_wallet_set GUARDED_BY(g_wallet_release_mutex); // Custom deleter for shared_ptr<CWallet>. -static void ReleaseWallet(CWallet* wallet) +static void FlushAndDeleteWallet(CWallet* wallet) { const std::string name = wallet->GetName(); - wallet->WalletLogPrintf("Releasing wallet\n"); + wallet->WalletLogPrintf("Releasing wallet %s..\n", name); wallet->Flush(); delete wallet; // Wallet is now released, notify WaitForDeleteWallet, if any. @@ -255,7 +255,7 @@ void WaitForDeleteWallet(std::shared_ptr<CWallet>&& wallet) // Multiple threads could simultaneously be waiting for deletion. } - // Time to ditch our shared_ptr and wait for ReleaseWallet call. + // Time to ditch our shared_ptr and wait for FlushAndDeleteWallet call. wallet.reset(); { WAIT_LOCK(g_wallet_release_mutex, lock); @@ -2972,7 +2972,7 @@ std::shared_ptr<CWallet> CWallet::Create(WalletContext& context, const std::stri const auto start{SteadyClock::now()}; // TODO: Can't use std::make_shared because we need a custom deleter but // should be possible to use std::allocate_shared. - std::shared_ptr<CWallet> walletInstance(new CWallet(chain, name, std::move(database)), ReleaseWallet); + std::shared_ptr<CWallet> walletInstance(new CWallet(chain, name, std::move(database)), FlushAndDeleteWallet); walletInstance->m_keypool_size = std::max(args.GetIntArg("-keypool", DEFAULT_KEYPOOL_SIZE), int64_t{1}); walletInstance->m_notify_tx_changed_script = args.GetArg("-walletnotify", ""); |