Skip to content

Commit

Permalink
[wallet] Add FlushWallets() 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 1b9cee6 commit 2da5eaf
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -189,9 +189,7 @@ void Shutdown()
StopRPC();
StopHTTPServer();
#ifdef ENABLE_WALLET
for (CWalletRef pwallet : vpwallets) {
pwallet->Flush(false);
}
FlushWallets(false);
#endif
MapPort(false);
UnregisterValidationInterface(peerLogic.get());
Expand Down Expand Up @@ -246,9 +244,7 @@ void Shutdown()
pblocktree = nullptr;
}
#ifdef ENABLE_WALLET
for (CWalletRef pwallet : vpwallets) {
pwallet->Flush(true);
}
FlushWallets(true);
#endif

#if ENABLE_ZMQ
Expand Down
6 changes: 6 additions & 0 deletions src/wallet/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -245,3 +245,9 @@ bool OpenWallets()

return true;
}

void FlushWallets(bool shutdown) {
for (CWalletRef pwallet : vpwallets) {
pwallet->Flush(shutdown);
}
}
3 changes: 3 additions & 0 deletions src/wallet/init.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,7 @@ bool VerifyWallets();
//! Load wallet databases.
bool OpenWallets();

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

0 comments on commit 2da5eaf

Please sign in to comment.