Skip to content

Commit f550a8e

Browse files
committed
Rename ReleaseWallet to FlushAndDeleteWallet
To better describe the function's behavior. And add wallet name to logprint.
1 parent 64e736d commit f550a8e

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/wallet/wallet.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -227,10 +227,10 @@ static std::set<std::string> g_loading_wallet_set GUARDED_BY(g_loading_wallet_mu
227227
static std::set<std::string> g_unloading_wallet_set GUARDED_BY(g_wallet_release_mutex);
228228

229229
// Custom deleter for shared_ptr<CWallet>.
230-
static void ReleaseWallet(CWallet* wallet)
230+
static void FlushAndDeleteWallet(CWallet* wallet)
231231
{
232232
const std::string name = wallet->GetName();
233-
wallet->WalletLogPrintf("Releasing wallet\n");
233+
wallet->WalletLogPrintf("Releasing wallet %s..\n", name);
234234
wallet->Flush();
235235
delete wallet;
236236
// Wallet is now released, notify WaitForDeleteWallet, if any.
@@ -255,7 +255,7 @@ void WaitForDeleteWallet(std::shared_ptr<CWallet>&& wallet)
255255
// Multiple threads could simultaneously be waiting for deletion.
256256
}
257257

258-
// Time to ditch our shared_ptr and wait for ReleaseWallet call.
258+
// Time to ditch our shared_ptr and wait for FlushAndDeleteWallet call.
259259
wallet.reset();
260260
{
261261
WAIT_LOCK(g_wallet_release_mutex, lock);
@@ -2972,7 +2972,7 @@ std::shared_ptr<CWallet> CWallet::Create(WalletContext& context, const std::stri
29722972
const auto start{SteadyClock::now()};
29732973
// TODO: Can't use std::make_shared because we need a custom deleter but
29742974
// should be possible to use std::allocate_shared.
2975-
std::shared_ptr<CWallet> walletInstance(new CWallet(chain, name, std::move(database)), ReleaseWallet);
2975+
std::shared_ptr<CWallet> walletInstance(new CWallet(chain, name, std::move(database)), FlushAndDeleteWallet);
29762976
walletInstance->m_keypool_size = std::max(args.GetIntArg("-keypool", DEFAULT_KEYPOOL_SIZE), int64_t{1});
29772977
walletInstance->m_notify_tx_changed_script = args.GetArg("-walletnotify", "");
29782978

0 commit comments

Comments
 (0)