Skip to content

Commit

Permalink
[wallet] Add StopWallets() function to wallet/init.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
jnewbery committed Sep 7, 2017
1 parent 2da5eaf commit 77fe07c
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ void Shutdown()
StopRPC();
StopHTTPServer();
#ifdef ENABLE_WALLET
FlushWallets(false);
FlushWallets();
#endif
MapPort(false);
UnregisterValidationInterface(peerLogic.get());
Expand Down Expand Up @@ -244,7 +244,7 @@ void Shutdown()
pblocktree = nullptr;
}
#ifdef ENABLE_WALLET
FlushWallets(true);
StopWallets();
#endif

#if ENABLE_ZMQ
Expand Down
10 changes: 8 additions & 2 deletions src/wallet/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -246,8 +246,14 @@ bool OpenWallets()
return true;
}

void FlushWallets(bool shutdown) {
void FlushWallets() {
for (CWalletRef pwallet : vpwallets) {
pwallet->Flush(shutdown);
pwallet->Flush(false);
}
}

void StopWallets() {
for (CWalletRef pwallet : vpwallets) {
pwallet->Flush(true);
}
}
6 changes: 4 additions & 2 deletions src/wallet/init.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ bool VerifyWallets();
bool OpenWallets();

//! Flush all wallets in preparation for shutdown.
//! Call with shutdown = true to actually shutdown the wallet.
void FlushWallets(bool shutdown);
void FlushWallets();

//! Stop all wallets. Wallets will be flushed first.
void StopWallets();
#endif // BITCOIN_WALLET_INIT_H

0 comments on commit 77fe07c

Please sign in to comment.