From 2da5eafa47cdf81107bd3e71a709d404ebb6dcdb Mon Sep 17 00:00:00 2001 From: John Newbery Date: Mon, 28 Aug 2017 12:31:53 -0400 Subject: [wallet] Add FlushWallets() function to wallet/init.cpp --- src/init.cpp | 8 ++------ src/wallet/init.cpp | 6 ++++++ src/wallet/init.h | 3 +++ 3 files changed, 11 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/init.cpp b/src/init.cpp index ce368a6bb1..6d250a25cf 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -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()); @@ -246,9 +244,7 @@ void Shutdown() pblocktree = nullptr; } #ifdef ENABLE_WALLET - for (CWalletRef pwallet : vpwallets) { - pwallet->Flush(true); - } + FlushWallets(true); #endif #if ENABLE_ZMQ diff --git a/src/wallet/init.cpp b/src/wallet/init.cpp index f39201e79c..f58f3bc545 100644 --- a/src/wallet/init.cpp +++ b/src/wallet/init.cpp @@ -245,3 +245,9 @@ bool OpenWallets() return true; } + +void FlushWallets(bool shutdown) { + for (CWalletRef pwallet : vpwallets) { + pwallet->Flush(shutdown); + } +} diff --git a/src/wallet/init.h b/src/wallet/init.h index a66b359439..5445c72d1c 100644 --- a/src/wallet/init.h +++ b/src/wallet/init.h @@ -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 -- cgit v1.2.3