Skip to content

Commit 519c0a2

Browse files
committed
wallet: Swap order of Unload and Close on shutdown
StopWallets, now renamed to CloseWallets, was being called prior to UnloadWallets, which does not entirely make sense as UnloadWallets does additional database cleanups. UnloadWallets is now called first, then CloseWallets.
1 parent 55340f2 commit 519c0a2

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

src/wallet/interfaces.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -572,7 +572,7 @@ class WalletLoaderImpl : public WalletLoader
572572
m_context.chain = &chain;
573573
m_context.args = &args;
574574
}
575-
~WalletLoaderImpl() override { UnloadWallets(m_context); }
575+
~WalletLoaderImpl() override { CloseWallets(m_context); }
576576

577577
//! ChainClient methods
578578
void registerRpcs() override
@@ -594,7 +594,7 @@ class WalletLoaderImpl : public WalletLoader
594594
return StartWallets(m_context);
595595
}
596596
void flush() override { return FlushWallets(m_context); }
597-
void stop() override { return StopWallets(m_context); }
597+
void stop() override { return UnloadWallets(m_context); }
598598
void setMockTime(int64_t time) override { return SetMockTime(time); }
599599
void schedulerMockForward(std::chrono::seconds delta) override { Assert(m_context.scheduler)->MockForward(delta); }
600600

src/wallet/load.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ void FlushWallets(WalletContext& context)
173173
}
174174
}
175175

176-
void StopWallets(WalletContext& context)
176+
void CloseWallets(WalletContext& context)
177177
{
178178
for (const std::shared_ptr<CWallet>& pwallet : GetWallets(context)) {
179179
pwallet->Close();

src/wallet/load.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@ void StartWallets(WalletContext& context);
3131
//! Flush all wallets in preparation for shutdown.
3232
void FlushWallets(WalletContext& context);
3333

34-
//! Stop all wallets. Wallets will be flushed first.
35-
void StopWallets(WalletContext& context);
34+
//! Close all wallet databases.
35+
void CloseWallets(WalletContext& context);
3636

37-
//! Close all wallets.
37+
//! Flush and unload all wallets.
3838
void UnloadWallets(WalletContext& context);
3939
} // namespace wallet
4040

0 commit comments

Comments
 (0)