aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2015-07-27 14:25:13 +0200
committerWladimir J. van der Laan <laanwj@gmail.com>2015-07-27 14:40:29 +0200
commitca37e0f33980a1fe96ac4ed08fd7d692a7a592a5 (patch)
treeb41b017d88a4db6863cd0fadbee8178aa85f3fa5
parent240b30eaf0b94a0094b8943dd9c01448bc29c3ba (diff)
parent60c8bac77c6612b84e3496b2227a01058d720ecc (diff)
Merge pull request #5697
60c8bac Includes: Cleanup around net main and wallet (Jorge Timón) 9dd793f TRIVIAL: Missing includes (Jorge Timón)
-rw-r--r--src/alert.cpp1
-rw-r--r--src/bitcoind.cpp2
-rw-r--r--src/checkpoints.cpp1
-rw-r--r--src/init.cpp5
-rw-r--r--src/main.cpp8
-rw-r--r--src/main.h11
-rw-r--r--src/miner.cpp4
-rw-r--r--src/net.cpp4
-rw-r--r--src/net.h3
-rw-r--r--src/qt/bitcoin.cpp2
-rw-r--r--src/qt/clientmodel.cpp1
-rw-r--r--src/qt/coincontroldialog.cpp3
-rw-r--r--src/qt/guiutil.cpp2
-rw-r--r--src/qt/optionsdialog.cpp2
-rw-r--r--src/qt/optionsmodel.cpp2
-rw-r--r--src/qt/paymentserver.cpp2
-rw-r--r--src/qt/peertablemodel.h2
-rw-r--r--src/qt/rpcconsole.cpp1
-rw-r--r--src/qt/sendcoinsdialog.cpp3
-rw-r--r--src/qt/transactiontablemodel.cpp2
-rw-r--r--src/qt/walletmodel.cpp2
-rw-r--r--src/rest.cpp1
-rw-r--r--src/rpcblockchain.cpp6
-rw-r--r--src/rpcmining.cpp3
-rw-r--r--src/rpcmisc.cpp1
-rw-r--r--src/rpcnet.cpp2
-rw-r--r--src/rpcrawtransaction.cpp4
-rw-r--r--src/test/DoS_tests.cpp5
-rw-r--r--src/test/alert_tests.cpp5
-rw-r--r--src/test/checkblock_tests.cpp3
-rw-r--r--src/test/mempool_tests.cpp1
-rw-r--r--src/test/miner_tests.cpp5
-rw-r--r--src/test/pow_tests.cpp4
-rw-r--r--src/test/script_tests.cpp2
-rw-r--r--src/test/sighash_tests.cpp5
-rw-r--r--src/test/skiplist_tests.cpp2
-rw-r--r--src/test/test_bitcoin.cpp1
-rw-r--r--src/test/transaction_tests.cpp3
-rw-r--r--src/txdb.cpp1
-rw-r--r--src/wallet/rpcdump.cpp3
-rw-r--r--src/wallet/rpcwallet.cpp1
-rw-r--r--src/wallet/wallet.cpp6
-rw-r--r--src/wallet/wallet.h5
-rw-r--r--src/wallet/wallet_ismine.h3
-rw-r--r--src/wallet/walletdb.cpp2
-rw-r--r--src/wallet/walletdb.h1
46 files changed, 92 insertions, 46 deletions
diff --git a/src/alert.cpp b/src/alert.cpp
index ad81e74226..91e54a9178 100644
--- a/src/alert.cpp
+++ b/src/alert.cpp
@@ -11,6 +11,7 @@
#include "timedata.h"
#include "ui_interface.h"
#include "util.h"
+#include "utilstrencodings.h"
#include <stdint.h>
#include <algorithm>
diff --git a/src/bitcoind.cpp b/src/bitcoind.cpp
index cce687ac98..39bb301f44 100644
--- a/src/bitcoind.cpp
+++ b/src/bitcoind.cpp
@@ -3,10 +3,10 @@
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
+#include "chainparams.h"
#include "clientversion.h"
#include "rpcserver.h"
#include "init.h"
-#include "main.h"
#include "noui.h"
#include "scheduler.h"
#include "util.h"
diff --git a/src/checkpoints.cpp b/src/checkpoints.cpp
index 87f4ad7f2e..a9822eed89 100644
--- a/src/checkpoints.cpp
+++ b/src/checkpoints.cpp
@@ -4,6 +4,7 @@
#include "checkpoints.h"
+#include "chain.h"
#include "chainparams.h"
#include "main.h"
#include "uint256.h"
diff --git a/src/init.cpp b/src/init.cpp
index ecf05d95b4..365bd30714 100644
--- a/src/init.cpp
+++ b/src/init.cpp
@@ -11,6 +11,8 @@
#include "addrman.h"
#include "amount.h"
+#include "chain.h"
+#include "chainparams.h"
#include "checkpoints.h"
#include "compat/sanity.h"
#include "consensus/validation.h"
@@ -23,11 +25,14 @@
#include "script/standard.h"
#include "scheduler.h"
#include "txdb.h"
+#include "txmempool.h"
#include "ui_interface.h"
#include "util.h"
#include "utilmoneystr.h"
+#include "utilstrencodings.h"
#include "validationinterface.h"
#ifdef ENABLE_WALLET
+#include "wallet/db.h"
#include "wallet/wallet.h"
#include "wallet/walletdb.h"
#endif
diff --git a/src/main.cpp b/src/main.cpp
index 54f9f89c4d..fefeabeb64 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -13,17 +13,25 @@
#include "checkqueue.h"
#include "consensus/consensus.h"
#include "consensus/validation.h"
+#include "hash.h"
#include "init.h"
#include "merkleblock.h"
#include "net.h"
#include "policy/policy.h"
#include "pow.h"
+#include "primitives/block.h"
+#include "primitives/transaction.h"
+#include "script/script.h"
+#include "script/sigcache.h"
+#include "script/standard.h"
+#include "tinyformat.h"
#include "txdb.h"
#include "txmempool.h"
#include "ui_interface.h"
#include "undo.h"
#include "util.h"
#include "utilmoneystr.h"
+#include "utilstrencodings.h"
#include "validationinterface.h"
#include <sstream>
diff --git a/src/main.h b/src/main.h
index ce18bd709f..96ad54cda6 100644
--- a/src/main.h
+++ b/src/main.h
@@ -12,18 +12,10 @@
#include "amount.h"
#include "chain.h"
-#include "chainparams.h"
#include "coins.h"
#include "net.h"
-#include "primitives/block.h"
-#include "primitives/transaction.h"
-#include "script/script.h"
-#include "script/sigcache.h"
-#include "script/standard.h"
+#include "script/script_error.h"
#include "sync.h"
-#include "tinyformat.h"
-#include "txmempool.h"
-#include "uint256.h"
#include <algorithm>
#include <exception>
@@ -41,6 +33,7 @@ class CBlockTreeDB;
class CBloomFilter;
class CInv;
class CScriptCheck;
+class CTxMemPool;
class CValidationInterface;
class CValidationState;
diff --git a/src/miner.cpp b/src/miner.cpp
index 5e575f45f1..e44f3392c8 100644
--- a/src/miner.cpp
+++ b/src/miner.cpp
@@ -6,7 +6,9 @@
#include "miner.h"
#include "amount.h"
+#include "chain.h"
#include "chainparams.h"
+#include "coins.h"
#include "consensus/consensus.h"
#include "consensus/validation.h"
#include "hash.h"
@@ -15,7 +17,9 @@
#include "policy/policy.h"
#include "pow.h"
#include "primitives/transaction.h"
+#include "script/standard.h"
#include "timedata.h"
+#include "txmempool.h"
#include "util.h"
#include "utilmoneystr.h"
#include "validationinterface.h"
diff --git a/src/net.cpp b/src/net.cpp
index 5cb6527c9b..3cece520de 100644
--- a/src/net.cpp
+++ b/src/net.cpp
@@ -12,10 +12,12 @@
#include "addrman.h"
#include "chainparams.h"
#include "clientversion.h"
+#include "crypto/common.h"
+#include "hash.h"
#include "primitives/transaction.h"
#include "scheduler.h"
#include "ui_interface.h"
-#include "crypto/common.h"
+#include "utilstrencodings.h"
#ifdef WIN32
#include <string.h>
diff --git a/src/net.h b/src/net.h
index 86d74e2174..658f586b12 100644
--- a/src/net.h
+++ b/src/net.h
@@ -8,7 +8,6 @@
#include "bloom.h"
#include "compat.h"
-#include "hash.h"
#include "limitedmap.h"
#include "mruset.h"
#include "netbase.h"
@@ -17,7 +16,6 @@
#include "streams.h"
#include "sync.h"
#include "uint256.h"
-#include "utilstrencodings.h"
#include <deque>
#include <stdint.h>
@@ -31,7 +29,6 @@
#include <boost/signals2/signal.hpp>
class CAddrMan;
-class CBlockIndex;
class CScheduler;
class CNode;
diff --git a/src/qt/bitcoin.cpp b/src/qt/bitcoin.cpp
index 8a78533420..b8aec0c268 100644
--- a/src/qt/bitcoin.cpp
+++ b/src/qt/bitcoin.cpp
@@ -8,6 +8,7 @@
#include "bitcoingui.h"
+#include "chainparams.h"
#include "clientmodel.h"
#include "guiconstants.h"
#include "guiutil.h"
@@ -24,7 +25,6 @@
#endif
#include "init.h"
-#include "main.h"
#include "rpcserver.h"
#include "scheduler.h"
#include "ui_interface.h"
diff --git a/src/qt/clientmodel.cpp b/src/qt/clientmodel.cpp
index 92a9ef279d..41dc2ea77e 100644
--- a/src/qt/clientmodel.cpp
+++ b/src/qt/clientmodel.cpp
@@ -11,7 +11,6 @@
#include "chainparams.h"
#include "checkpoints.h"
#include "clientversion.h"
-#include "main.h"
#include "net.h"
#include "ui_interface.h"
#include "util.h"
diff --git a/src/qt/coincontroldialog.cpp b/src/qt/coincontroldialog.cpp
index 778dbcb1ca..934d62d5f7 100644
--- a/src/qt/coincontroldialog.cpp
+++ b/src/qt/coincontroldialog.cpp
@@ -10,11 +10,12 @@
#include "guiutil.h"
#include "optionsmodel.h"
#include "scicon.h"
+#include "txmempool.h"
#include "walletmodel.h"
#include "coincontrol.h"
#include "init.h"
-#include "main.h"
+#include "main.h" // For minRelayTxFee
#include "wallet/wallet.h"
#include <boost/assign/list_of.hpp> // for 'map_list_of()'
diff --git a/src/qt/guiutil.cpp b/src/qt/guiutil.cpp
index 581d2321bc..550dbacf93 100644
--- a/src/qt/guiutil.cpp
+++ b/src/qt/guiutil.cpp
@@ -11,7 +11,7 @@
#include "primitives/transaction.h"
#include "init.h"
-#include "main.h"
+#include "main.h" // For minRelayTxFee
#include "protocol.h"
#include "script/script.h"
#include "script/standard.h"
diff --git a/src/qt/optionsdialog.cpp b/src/qt/optionsdialog.cpp
index 173bed3b62..062c4540ee 100644
--- a/src/qt/optionsdialog.cpp
+++ b/src/qt/optionsdialog.cpp
@@ -13,7 +13,7 @@
#include "guiutil.h"
#include "optionsmodel.h"
-#include "main.h" // for MAX_SCRIPTCHECK_THREADS
+#include "main.h" // for DEFAULT_SCRIPTCHECK_THREADS and MAX_SCRIPTCHECK_THREADS
#include "netbase.h"
#include "txdb.h" // for -dbcache defaults
diff --git a/src/qt/optionsmodel.cpp b/src/qt/optionsmodel.cpp
index b4ce8191d0..6191edc44c 100644
--- a/src/qt/optionsmodel.cpp
+++ b/src/qt/optionsmodel.cpp
@@ -13,7 +13,7 @@
#include "amount.h"
#include "init.h"
-#include "main.h"
+#include "main.h" // For DEFAULT_SCRIPTCHECK_THREADS
#include "net.h"
#include "txdb.h" // for -dbcache defaults
diff --git a/src/qt/paymentserver.cpp b/src/qt/paymentserver.cpp
index 6481b0046e..0827d99125 100644
--- a/src/qt/paymentserver.cpp
+++ b/src/qt/paymentserver.cpp
@@ -10,7 +10,7 @@
#include "base58.h"
#include "chainparams.h"
-#include "main.h"
+#include "main.h" // For minRelayTxFee
#include "ui_interface.h"
#include "util.h"
#include "wallet/wallet.h"
diff --git a/src/qt/peertablemodel.h b/src/qt/peertablemodel.h
index fcb89b7611..5f149ea873 100644
--- a/src/qt/peertablemodel.h
+++ b/src/qt/peertablemodel.h
@@ -5,7 +5,7 @@
#ifndef BITCOIN_QT_PEERTABLEMODEL_H
#define BITCOIN_QT_PEERTABLEMODEL_H
-#include "main.h"
+#include "main.h" // For CNodeStateStats
#include "net.h"
#include <QAbstractTableModel>
diff --git a/src/qt/rpcconsole.cpp b/src/qt/rpcconsole.cpp
index 2fafb83d43..b2717558ca 100644
--- a/src/qt/rpcconsole.cpp
+++ b/src/qt/rpcconsole.cpp
@@ -10,7 +10,6 @@
#include "peertablemodel.h"
#include "scicon.h"
-#include "main.h"
#include "chainparams.h"
#include "rpcserver.h"
#include "rpcclient.h"
diff --git a/src/qt/sendcoinsdialog.cpp b/src/qt/sendcoinsdialog.cpp
index e13cd714a6..2407fcbc4a 100644
--- a/src/qt/sendcoinsdialog.cpp
+++ b/src/qt/sendcoinsdialog.cpp
@@ -17,8 +17,9 @@
#include "base58.h"
#include "coincontrol.h"
-#include "main.h"
+#include "main.h" // mempool and minRelayTxFee
#include "ui_interface.h"
+#include "txmempool.h"
#include "wallet/wallet.h"
#include <QMessageBox>
diff --git a/src/qt/transactiontablemodel.cpp b/src/qt/transactiontablemodel.cpp
index e3d64387f7..f384562a50 100644
--- a/src/qt/transactiontablemodel.cpp
+++ b/src/qt/transactiontablemodel.cpp
@@ -25,6 +25,8 @@
#include <QIcon>
#include <QList>
+#include <boost/foreach.hpp>
+
// Amount column is right-aligned it contains numbers
static int column_alignments[] = {
Qt::AlignLeft|Qt::AlignVCenter, /* status */
diff --git a/src/qt/walletmodel.cpp b/src/qt/walletmodel.cpp
index 168a0255ff..7820047b6b 100644
--- a/src/qt/walletmodel.cpp
+++ b/src/qt/walletmodel.cpp
@@ -25,6 +25,8 @@
#include <QSet>
#include <QTimer>
+#include <boost/foreach.hpp>
+
WalletModel::WalletModel(CWallet *wallet, OptionsModel *optionsModel, QObject *parent) :
QObject(parent), wallet(wallet), optionsModel(optionsModel), addressTableModel(0),
transactionTableModel(0),
diff --git a/src/rest.cpp b/src/rest.cpp
index dfe01495f7..0dd238b683 100644
--- a/src/rest.cpp
+++ b/src/rest.cpp
@@ -3,6 +3,7 @@
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
+#include "chain.h"
#include "primitives/block.h"
#include "primitives/transaction.h"
#include "main.h"
diff --git a/src/rpcblockchain.cpp b/src/rpcblockchain.cpp
index f1c5ffe050..5817f0ce57 100644
--- a/src/rpcblockchain.cpp
+++ b/src/rpcblockchain.cpp
@@ -3,13 +3,19 @@
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
+#include "chain.h"
+#include "chainparams.h"
#include "checkpoints.h"
+#include "coins.h"
#include "consensus/validation.h"
#include "main.h"
#include "primitives/transaction.h"
#include "rpcserver.h"
+#include "streams.h"
#include "sync.h"
+#include "txmempool.h"
#include "util.h"
+#include "utilstrencodings.h"
#include <stdint.h>
diff --git a/src/rpcmining.cpp b/src/rpcmining.cpp
index 703b0ee653..b7d4ff58fc 100644
--- a/src/rpcmining.cpp
+++ b/src/rpcmining.cpp
@@ -4,6 +4,7 @@
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include "amount.h"
+#include "chain.h"
#include "chainparams.h"
#include "consensus/consensus.h"
#include "consensus/validation.h"
@@ -14,7 +15,9 @@
#include "net.h"
#include "pow.h"
#include "rpcserver.h"
+#include "txmempool.h"
#include "util.h"
+#include "utilstrencodings.h"
#include "validationinterface.h"
#include <stdint.h>
diff --git a/src/rpcmisc.cpp b/src/rpcmisc.cpp
index cab57d7027..82003e09b9 100644
--- a/src/rpcmisc.cpp
+++ b/src/rpcmisc.cpp
@@ -12,6 +12,7 @@
#include "rpcserver.h"
#include "timedata.h"
#include "util.h"
+#include "utilstrencodings.h"
#ifdef ENABLE_WALLET
#include "wallet/wallet.h"
#include "wallet/walletdb.h"
diff --git a/src/rpcnet.cpp b/src/rpcnet.cpp
index dd631905fd..ed903f9fd3 100644
--- a/src/rpcnet.cpp
+++ b/src/rpcnet.cpp
@@ -4,6 +4,7 @@
#include "rpcserver.h"
+#include "chainparams.h"
#include "clientversion.h"
#include "main.h"
#include "net.h"
@@ -12,6 +13,7 @@
#include "sync.h"
#include "timedata.h"
#include "util.h"
+#include "utilstrencodings.h"
#include "version.h"
#include <boost/foreach.hpp>
diff --git a/src/rpcrawtransaction.cpp b/src/rpcrawtransaction.cpp
index 7d1db0b60e..62d2ef69ef 100644
--- a/src/rpcrawtransaction.cpp
+++ b/src/rpcrawtransaction.cpp
@@ -4,6 +4,8 @@
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include "base58.h"
+#include "chain.h"
+#include "coins.h"
#include "consensus/validation.h"
#include "core_io.h"
#include "init.h"
@@ -18,7 +20,9 @@
#include "script/script_error.h"
#include "script/sign.h"
#include "script/standard.h"
+#include "txmempool.h"
#include "uint256.h"
+#include "utilstrencodings.h"
#ifdef ENABLE_WALLET
#include "wallet/wallet.h"
#endif
diff --git a/src/test/DoS_tests.cpp b/src/test/DoS_tests.cpp
index bf25548755..da296a0461 100644
--- a/src/test/DoS_tests.cpp
+++ b/src/test/DoS_tests.cpp
@@ -2,12 +2,9 @@
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
-//
// Unit tests for denial-of-service detection/prevention code
-//
-
-
+#include "chainparams.h"
#include "keystore.h"
#include "main.h"
#include "net.h"
diff --git a/src/test/alert_tests.cpp b/src/test/alert_tests.cpp
index 38dcc6023c..b8d5606cc3 100644
--- a/src/test/alert_tests.cpp
+++ b/src/test/alert_tests.cpp
@@ -2,17 +2,14 @@
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
-//
// Unit tests for alert system
-//
#include "alert.h"
#include "chain.h"
#include "chainparams.h"
#include "clientversion.h"
#include "data/alertTests.raw.h"
-
-#include "main.h"
+#include "main.h" // For PartitionCheck
#include "serialize.h"
#include "streams.h"
#include "util.h"
diff --git a/src/test/checkblock_tests.cpp b/src/test/checkblock_tests.cpp
index 51530c4de5..f7e2470617 100644
--- a/src/test/checkblock_tests.cpp
+++ b/src/test/checkblock_tests.cpp
@@ -4,7 +4,8 @@
#include "clientversion.h"
#include "consensus/validation.h"
-#include "main.h"
+#include "main.h" // For CheckBlock
+#include "primitives/block.h"
#include "test/test_bitcoin.h"
#include "utiltime.h"
diff --git a/src/test/mempool_tests.cpp b/src/test/mempool_tests.cpp
index 0996e13c48..2439689d7f 100644
--- a/src/test/mempool_tests.cpp
+++ b/src/test/mempool_tests.cpp
@@ -2,7 +2,6 @@
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
-#include "main.h"
#include "txmempool.h"
#include "util.h"
diff --git a/src/test/miner_tests.cpp b/src/test/miner_tests.cpp
index 212be0d2d6..ad79a558c2 100644
--- a/src/test/miner_tests.cpp
+++ b/src/test/miner_tests.cpp
@@ -2,12 +2,17 @@
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
+#include "chainparams.h"
+#include "coins.h"
#include "consensus/validation.h"
#include "main.h"
#include "miner.h"
#include "pubkey.h"
+#include "script/standard.h"
+#include "txmempool.h"
#include "uint256.h"
#include "util.h"
+#include "utilstrencodings.h"
#include "test/test_bitcoin.h"
diff --git a/src/test/pow_tests.cpp b/src/test/pow_tests.cpp
index a436749287..b6eb39bc38 100644
--- a/src/test/pow_tests.cpp
+++ b/src/test/pow_tests.cpp
@@ -2,8 +2,10 @@
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
-#include "main.h"
+#include "chain.h"
+#include "chainparams.h"
#include "pow.h"
+#include "random.h"
#include "util.h"
#include "test/test_bitcoin.h"
diff --git a/src/test/script_tests.cpp b/src/test/script_tests.cpp
index 3733425699..37c046935f 100644
--- a/src/test/script_tests.cpp
+++ b/src/test/script_tests.cpp
@@ -8,11 +8,11 @@
#include "core_io.h"
#include "key.h"
#include "keystore.h"
-#include "main.h"
#include "script/script.h"
#include "script/script_error.h"
#include "script/sign.h"
#include "util.h"
+#include "utilstrencodings.h"
#include "test/test_bitcoin.h"
#if defined(HAVE_CONSENSUS_LIB)
diff --git a/src/test/sighash_tests.cpp b/src/test/sighash_tests.cpp
index a0797d5f3f..4b96461562 100644
--- a/src/test/sighash_tests.cpp
+++ b/src/test/sighash_tests.cpp
@@ -4,13 +4,16 @@
#include "consensus/validation.h"
#include "data/sighash.json.h"
-#include "main.h"
+#include "hash.h"
+#include "main.h" // For CheckTransaction
#include "random.h"
#include "script/interpreter.h"
#include "script/script.h"
#include "serialize.h"
+#include "streams.h"
#include "test/test_bitcoin.h"
#include "util.h"
+#include "utilstrencodings.h"
#include "version.h"
#include <iostream>
diff --git a/src/test/skiplist_tests.cpp b/src/test/skiplist_tests.cpp
index 86a4bc6727..a904e3862f 100644
--- a/src/test/skiplist_tests.cpp
+++ b/src/test/skiplist_tests.cpp
@@ -2,7 +2,7 @@
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
-#include "main.h"
+#include "chain.h"
#include "random.h"
#include "util.h"
#include "test/test_bitcoin.h"
diff --git a/src/test/test_bitcoin.cpp b/src/test/test_bitcoin.cpp
index c727303ea1..ba616365f2 100644
--- a/src/test/test_bitcoin.cpp
+++ b/src/test/test_bitcoin.cpp
@@ -6,6 +6,7 @@
#include "test_bitcoin.h"
+#include "chainparams.h"
#include "key.h"
#include "main.h"
#include "random.h"
diff --git a/src/test/transaction_tests.cpp b/src/test/transaction_tests.cpp
index 260524f7cc..e70ebddc2f 100644
--- a/src/test/transaction_tests.cpp
+++ b/src/test/transaction_tests.cpp
@@ -11,10 +11,11 @@
#include "core_io.h"
#include "key.h"
#include "keystore.h"
-#include "main.h"
+#include "main.h" // For CheckTransaction
#include "policy/policy.h"
#include "script/script.h"
#include "script/script_error.h"
+#include "utilstrencodings.h"
#include <map>
#include <string>
diff --git a/src/txdb.cpp b/src/txdb.cpp
index 935b784676..21ecd65238 100644
--- a/src/txdb.cpp
+++ b/src/txdb.cpp
@@ -5,6 +5,7 @@
#include "txdb.h"
+#include "chain.h"
#include "chainparams.h"
#include "hash.h"
#include "main.h"
diff --git a/src/wallet/rpcdump.cpp b/src/wallet/rpcdump.cpp
index 5f800474a0..dbe36a2be1 100644
--- a/src/wallet/rpcdump.cpp
+++ b/src/wallet/rpcdump.cpp
@@ -3,6 +3,7 @@
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include "base58.h"
+#include "chain.h"
#include "rpcserver.h"
#include "init.h"
#include "main.h"
@@ -21,6 +22,8 @@
#include "univalue/univalue.h"
+#include <boost/foreach.hpp>
+
using namespace std;
void EnsureWalletIsUnlocked();
diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp
index f6ca8cbb76..342ce13af1 100644
--- a/src/wallet/rpcwallet.cpp
+++ b/src/wallet/rpcwallet.cpp
@@ -5,6 +5,7 @@
#include "amount.h"
#include "base58.h"
+#include "chain.h"
#include "core_io.h"
#include "init.h"
#include "main.h"
diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp
index 7b3cd9803b..58b9ccc078 100644
--- a/src/wallet/wallet.cpp
+++ b/src/wallet/wallet.cpp
@@ -7,15 +7,21 @@
#include "base58.h"
#include "checkpoints.h"
+#include "chain.h"
#include "coincontrol.h"
#include "consensus/consensus.h"
#include "consensus/validation.h"
+#include "key.h"
+#include "keystore.h"
#include "main.h"
#include "net.h"
#include "policy/policy.h"
+#include "primitives/block.h"
+#include "primitives/transaction.h"
#include "script/script.h"
#include "script/sign.h"
#include "timedata.h"
+#include "txmempool.h"
#include "util.h"
#include "utilmoneystr.h"
diff --git a/src/wallet/wallet.h b/src/wallet/wallet.h
index 003266ba19..ae007e4673 100644
--- a/src/wallet/wallet.h
+++ b/src/wallet/wallet.h
@@ -7,10 +7,7 @@
#define BITCOIN_WALLET_WALLET_H
#include "amount.h"
-#include "key.h"
-#include "keystore.h"
-#include "primitives/block.h"
-#include "primitives/transaction.h"
+#include "streams.h"
#include "tinyformat.h"
#include "ui_interface.h"
#include "utilstrencodings.h"
diff --git a/src/wallet/wallet_ismine.h b/src/wallet/wallet_ismine.h
index 5b9b0e0841..7846565f8d 100644
--- a/src/wallet/wallet_ismine.h
+++ b/src/wallet/wallet_ismine.h
@@ -6,9 +6,10 @@
#ifndef BITCOIN_WALLET_WALLET_ISMINE_H
#define BITCOIN_WALLET_WALLET_ISMINE_H
-#include "key.h"
#include "script/standard.h"
+#include <stdint.h>
+
class CKeyStore;
class CScript;
diff --git a/src/wallet/walletdb.cpp b/src/wallet/walletdb.cpp
index f777926e72..c1eb184581 100644
--- a/src/wallet/walletdb.cpp
+++ b/src/wallet/walletdb.cpp
@@ -7,7 +7,7 @@
#include "base58.h"
#include "consensus/validation.h"
-#include "main.h"
+#include "main.h" // For CheckTransaction
#include "protocol.h"
#include "serialize.h"
#include "sync.h"
diff --git a/src/wallet/walletdb.h b/src/wallet/walletdb.h
index bc1a104b5b..270f826aed 100644
--- a/src/wallet/walletdb.h
+++ b/src/wallet/walletdb.h
@@ -9,7 +9,6 @@
#include "amount.h"
#include "wallet/db.h"
#include "key.h"
-#include "keystore.h"
#include <list>
#include <stdint.h>