Skip to content

Commit 2da5eaf

Browse files
committed
[wallet] Add FlushWallets() function to wallet/init.cpp
1 parent 1b9cee6 commit 2da5eaf

File tree

3 files changed

+11
-6
lines changed

3 files changed

+11
-6
lines changed

src/init.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -189,9 +189,7 @@ void Shutdown()
189189
StopRPC();
190190
StopHTTPServer();
191191
#ifdef ENABLE_WALLET
192-
for (CWalletRef pwallet : vpwallets) {
193-
pwallet->Flush(false);
194-
}
192+
FlushWallets(false);
195193
#endif
196194
MapPort(false);
197195
UnregisterValidationInterface(peerLogic.get());
@@ -246,9 +244,7 @@ void Shutdown()
246244
pblocktree = nullptr;
247245
}
248246
#ifdef ENABLE_WALLET
249-
for (CWalletRef pwallet : vpwallets) {
250-
pwallet->Flush(true);
251-
}
247+
FlushWallets(true);
252248
#endif
253249

254250
#if ENABLE_ZMQ

src/wallet/init.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,3 +245,9 @@ bool OpenWallets()
245245

246246
return true;
247247
}
248+
249+
void FlushWallets(bool shutdown) {
250+
for (CWalletRef pwallet : vpwallets) {
251+
pwallet->Flush(shutdown);
252+
}
253+
}

src/wallet/init.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,7 @@ bool VerifyWallets();
2222
//! Load wallet databases.
2323
bool OpenWallets();
2424

25+
//! Flush all wallets in preparation for shutdown.
26+
//! Call with shutdown = true to actually shutdown the wallet.
27+
void FlushWallets(bool shutdown);
2528
#endif // BITCOIN_WALLET_INIT_H

0 commit comments

Comments
 (0)