Skip to content

Commit 876a258

Browse files
committed
wallet: Remove unnecessary database Close step on shutdown
StopWallets, which was being called prior to UnloadWallets, performs an unnecessary database closing step. This causes issues in UnloadWallets which does additional database cleanups. Since the database closing step is unnecessary, StopWallets is removed, and UnloadWallets is now called from WalletLoaderImpl::stop.
1 parent 98a1a52 commit 876a258

File tree

3 files changed

+2
-13
lines changed

3 files changed

+2
-13
lines changed

src/wallet/interfaces.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -553,7 +553,7 @@ class WalletLoaderImpl : public WalletLoader
553553
m_context.chain = &chain;
554554
m_context.args = &args;
555555
}
556-
~WalletLoaderImpl() override { UnloadWallets(m_context); }
556+
~WalletLoaderImpl() override { stop(); }
557557

558558
//! ChainClient methods
559559
void registerRpcs() override
@@ -574,7 +574,7 @@ class WalletLoaderImpl : public WalletLoader
574574
m_context.scheduler = &scheduler;
575575
return StartWallets(m_context);
576576
}
577-
void stop() override { return StopWallets(m_context); }
577+
void stop() override { return UnloadWallets(m_context); }
578578
void setMockTime(int64_t time) override { return SetMockTime(time); }
579579
void schedulerMockForward(std::chrono::seconds delta) override { Assert(m_context.scheduler)->MockForward(delta); }
580580

src/wallet/load.cpp

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -162,13 +162,6 @@ void StartWallets(WalletContext& context)
162162
context.scheduler->scheduleEvery([&context] { MaybeResendWalletTxs(context); }, 1min);
163163
}
164164

165-
void StopWallets(WalletContext& context)
166-
{
167-
for (const std::shared_ptr<CWallet>& pwallet : GetWallets(context)) {
168-
pwallet->Close();
169-
}
170-
}
171-
172165
void UnloadWallets(WalletContext& context)
173166
{
174167
auto wallets = GetWallets(context);

src/wallet/load.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,6 @@ bool LoadWallets(WalletContext& context);
2828
//! Complete startup of wallets.
2929
void StartWallets(WalletContext& context);
3030

31-
//! Stop all wallets. Wallets will be flushed first.
32-
void StopWallets(WalletContext& context);
33-
34-
//! Close all wallets.
3531
void UnloadWallets(WalletContext& context);
3632
} // namespace wallet
3733

0 commit comments

Comments
 (0)