diff options
author | Pieter Wuille <pieter.wuille@gmail.com> | 2013-10-19 18:42:14 +0200 |
---|---|---|
committer | Pieter Wuille <pieter.wuille@gmail.com> | 2013-10-26 14:51:47 +0200 |
commit | 722fa283d04dfe9c70418e69535a08eea06b4377 (patch) | |
tree | c917f101a743cebd52c17ac777d47ed44c35c1fa /src | |
parent | 00588c3fac4822d42ffde46ca55c029a74c378ee (diff) |
Break dependency of init on wallet.
This required some code movement (what was CWalletTx::AcceptToMemoryPool
doing in main?), and adding a few explicit includes that used to be
implicit through init.h.
Diffstat (limited to 'src')
-rw-r--r-- | src/bitcoind.cpp | 3 | ||||
-rw-r--r-- | src/bitcoinrpc.cpp | 2 | ||||
-rw-r--r-- | src/init.h | 5 | ||||
-rw-r--r-- | src/main.cpp | 21 | ||||
-rw-r--r-- | src/qt/optionsmodel.cpp | 3 | ||||
-rw-r--r-- | src/rpcdump.cpp | 1 | ||||
-rw-r--r-- | src/wallet.cpp | 19 |
7 files changed, 32 insertions, 22 deletions
diff --git a/src/bitcoind.cpp b/src/bitcoind.cpp index fbacbd2e24..4fd3296069 100644 --- a/src/bitcoind.cpp +++ b/src/bitcoind.cpp @@ -3,7 +3,10 @@ // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. +#include "ui_interface.h" #include "init.h" +#include "util.h" +#include "main.h" #include "bitcoinrpc.h" #include <boost/algorithm/string/predicate.hpp> diff --git a/src/bitcoinrpc.cpp b/src/bitcoinrpc.cpp index f2a52e92ed..f3ea0adb40 100644 --- a/src/bitcoinrpc.cpp +++ b/src/bitcoinrpc.cpp @@ -4,6 +4,8 @@ // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "chainparams.h" +#include "main.h" +#include "wallet.h" #include "init.h" #include "util.h" #include "sync.h" diff --git a/src/init.h b/src/init.h index 785a6cdba1..8cb1bf52fc 100644 --- a/src/init.h +++ b/src/init.h @@ -5,7 +5,10 @@ #ifndef BITCOIN_INIT_H #define BITCOIN_INIT_H -#include "wallet.h" +#include <string> +#include <boost/thread.hpp> + +class CWallet; extern std::string strWalletFile; extern CWallet* pwalletMain; diff --git a/src/main.cpp b/src/main.cpp index b84c53ade1..072d0967f2 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1054,27 +1054,6 @@ bool CMerkleTx::AcceptToMemoryPool(bool fLimitFree) } - -bool CWalletTx::AcceptWalletTransaction() -{ - { - LOCK(mempool.cs); - // Add previous supporting transactions first - BOOST_FOREACH(CMerkleTx& tx, vtxPrev) - { - if (!tx.IsCoinBase()) - { - uint256 hash = tx.GetHash(); - if (!mempool.exists(hash) && pcoinsTip->HaveCoins(hash)) - tx.AcceptToMemoryPool(false); - } - } - return AcceptToMemoryPool(false); - } - return false; -} - - // Return transaction in tx, and if it was found inside a block, its hash is placed in hashBlock bool GetTransaction(const uint256 &hash, CTransaction &txOut, uint256 &hashBlock, bool fAllowSlow) { diff --git a/src/qt/optionsmodel.cpp b/src/qt/optionsmodel.cpp index 95efc58320..4db048dcce 100644 --- a/src/qt/optionsmodel.cpp +++ b/src/qt/optionsmodel.cpp @@ -6,6 +6,9 @@ #include "bitcoinunits.h" #include "init.h" +#include "core.h" +#include "wallet.h" +#include "netbase.h" #include "walletdb.h" #include "guiutil.h" diff --git a/src/rpcdump.cpp b/src/rpcdump.cpp index 3589b45900..a5f7a542de 100644 --- a/src/rpcdump.cpp +++ b/src/rpcdump.cpp @@ -6,6 +6,7 @@ #include <fstream> #include "init.h" // for pwalletMain +#include "wallet.h" #include "bitcoinrpc.h" #include "ui_interface.h" #include "base58.h" diff --git a/src/wallet.cpp b/src/wallet.cpp index bd9e2c7347..ea1e01e6e9 100644 --- a/src/wallet.cpp +++ b/src/wallet.cpp @@ -777,6 +777,25 @@ void CWalletTx::AddSupportingTransactions() reverse(vtxPrev.begin(), vtxPrev.end()); } +bool CWalletTx::AcceptWalletTransaction() +{ + { + LOCK(mempool.cs); + // Add previous supporting transactions first + BOOST_FOREACH(CMerkleTx& tx, vtxPrev) + { + if (!tx.IsCoinBase()) + { + uint256 hash = tx.GetHash(); + if (!mempool.exists(hash) && pcoinsTip->HaveCoins(hash)) + tx.AcceptToMemoryPool(false); + } + } + return AcceptToMemoryPool(false); + } + return false; +} + bool CWalletTx::WriteToDisk() { return CWalletDB(pwallet->strWalletFile).WriteTx(GetHash(), *this); |