Skip to content

Commit f9d7fe1

Browse files
committed
refactor: move bdb (bitdb) interaction from init.cpp to wallet.cpp
>>> based on bitcoin/bitcoin@2bb1c87 this will remove db.h from init.cpp
1 parent 9cfb711 commit f9d7fe1

File tree

3 files changed

+12
-5
lines changed

3 files changed

+12
-5
lines changed

src/init.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
// Copyright (c) 2009-2010 Satoshi Nakamoto
2-
// Copyright (c) 2009-2015 The Bitcoin developers
2+
// Copyright (c) 2009-2021 The Bitcoin developers
33
// Copyright (c) 2014-2015 The Dash developers
44
// Copyright (c) 2011-2013 The PPCoin developers
55
// Copyright (c) 2013-2014 The NovaCoin Developers
66
// Copyright (c) 2014-2018 The BlackCoin Developers
7-
// Copyright (c) 2015-2020 The PIVX developers
7+
// Copyright (c) 2015-2021 The PIVX developers
88
// Distributed under the MIT software license, see the accompanying
99
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
1010

@@ -58,7 +58,6 @@
5858
#include "zpivchain.h"
5959

6060
#ifdef ENABLE_WALLET
61-
#include "wallet/db.h"
6261
#include "wallet/wallet.h"
6362
#include "wallet/rpcwallet.h"
6463

@@ -223,7 +222,7 @@ void PrepareShutdown()
223222
StopHTTPServer();
224223
#ifdef ENABLE_WALLET
225224
if (pwalletMain)
226-
bitdb.Flush(false);
225+
pwalletMain->Flush(false);
227226
GenerateBitcoins(false, NULL, 0);
228227
#endif
229228
StopMapPort();
@@ -303,7 +302,7 @@ void PrepareShutdown()
303302
}
304303
#ifdef ENABLE_WALLET
305304
if (pwalletMain)
306-
bitdb.Flush(true);
305+
pwalletMain->Flush(true);
307306
#endif
308307

309308
if (pEvoNotificationInterface) {

src/wallet/wallet.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2069,6 +2069,11 @@ std::set<uint256> CWalletTx::GetConflicts() const
20692069
return result;
20702070
}
20712071

2072+
void CWallet::Flush(bool shutdown)
2073+
{
2074+
bitdb.Flush(shutdown);
2075+
}
2076+
20722077
bool CWallet::Verify()
20732078
{
20742079
if (gArgs.GetBoolArg("-disablewallet", DEFAULT_DISABLE_WALLET)) {

src/wallet/wallet.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1128,6 +1128,9 @@ class CWallet : public CCryptoKeyStore, public CValidationInterface
11281128
//! Get wallet transactions that conflict with given transaction (spend same outputs)
11291129
std::set<uint256> GetConflicts(const uint256& txid) const;
11301130

1131+
//! Flush wallet (bitdb flush)
1132+
void Flush(bool shutdown=false);
1133+
11311134
//! Verify the wallet database and perform salvage if required
11321135
static bool Verify();
11331136

0 commit comments

Comments
 (0)