diff options
author | Wladimir J. van der Laan <laanwj@gmail.com> | 2015-03-24 18:06:54 +0100 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2015-03-24 18:12:56 +0100 |
commit | 8d2fbfa49141172e1c63f5ab7b684a1f9e210571 (patch) | |
tree | f8cc7e9b3268bea6b3333a9bc9f3a3f48eb87fbb /src/wallet/wallet.h | |
parent | 22cfe23196c5006d6dd79e1e1a24323148246bde (diff) | |
parent | 8a893c949bf6b011c8ae1645888576bf236db79c (diff) | |
download | bitcoin-8d2fbfa49141172e1c63f5ab7b684a1f9e210571.tar.xz |
Merge pull request #5681
8a893c9 Includes: Do not include main.h from any other header (Jorge Timón)
eca0b1e Includes: MOVEONLY: move more method definitions out of wallet.h (Jorge Timón)
26c16d9 Includes: Refactor: Move CValidationInterface and CMainSignals out of main (Jorge Timón)
Diffstat (limited to 'src/wallet/wallet.h')
-rw-r--r-- | src/wallet/wallet.h | 78 |
1 files changed, 15 insertions, 63 deletions
diff --git a/src/wallet/wallet.h b/src/wallet/wallet.h index 3f5f2859b6..4a13f02195 100644 --- a/src/wallet/wallet.h +++ b/src/wallet/wallet.h @@ -7,12 +7,14 @@ #define BITCOIN_WALLET_H #include "amount.h" -#include "primitives/block.h" -#include "primitives/transaction.h" #include "key.h" #include "keystore.h" -#include "main.h" +#include "primitives/block.h" +#include "primitives/transaction.h" +#include "tinyformat.h" #include "ui_interface.h" +#include "utilstrencodings.h" +#include "validationinterface.h" #include "wallet/crypter.h" #include "wallet/wallet_ismine.h" #include "wallet/walletdb.h" @@ -48,10 +50,12 @@ static const CAmount nHighTransactionMaxFeeWarning = 100 * nHighTransactionFeeWa static const unsigned int MAX_FREE_TRANSACTION_CREATE_SIZE = 1000; class CAccountingEntry; +class CBlockIndex; class CCoinControl; class COutput; class CReserveKey; class CScript; +class CTxMemPool; class CWalletTx; /** (client) version numbers for particular wallet features */ @@ -640,68 +644,16 @@ public: isminetype IsMine(const CTxIn& txin) const; CAmount GetDebit(const CTxIn& txin, const isminefilter& filter) const; - isminetype IsMine(const CTxOut& txout) const - { - return ::IsMine(*this, txout.scriptPubKey); - } - CAmount GetCredit(const CTxOut& txout, const isminefilter& filter) const - { - if (!MoneyRange(txout.nValue)) - throw std::runtime_error("CWallet::GetCredit(): value out of range"); - return ((IsMine(txout) & filter) ? txout.nValue : 0); - } + isminetype IsMine(const CTxOut& txout) const; + CAmount GetCredit(const CTxOut& txout, const isminefilter& filter) const; bool IsChange(const CTxOut& txout) const; - CAmount GetChange(const CTxOut& txout) const - { - if (!MoneyRange(txout.nValue)) - throw std::runtime_error("CWallet::GetChange(): value out of range"); - return (IsChange(txout) ? txout.nValue : 0); - } - bool IsMine(const CTransaction& tx) const - { - BOOST_FOREACH(const CTxOut& txout, tx.vout) - if (IsMine(txout)) - return true; - return false; - } + CAmount GetChange(const CTxOut& txout) const; + bool IsMine(const CTransaction& tx) const; /** should probably be renamed to IsRelevantToMe */ - bool IsFromMe(const CTransaction& tx) const - { - return (GetDebit(tx, ISMINE_ALL) > 0); - } - CAmount GetDebit(const CTransaction& tx, const isminefilter& filter) const - { - CAmount nDebit = 0; - BOOST_FOREACH(const CTxIn& txin, tx.vin) - { - nDebit += GetDebit(txin, filter); - if (!MoneyRange(nDebit)) - throw std::runtime_error("CWallet::GetDebit(): value out of range"); - } - return nDebit; - } - CAmount GetCredit(const CTransaction& tx, const isminefilter& filter) const - { - CAmount nCredit = 0; - BOOST_FOREACH(const CTxOut& txout, tx.vout) - { - nCredit += GetCredit(txout, filter); - if (!MoneyRange(nCredit)) - throw std::runtime_error("CWallet::GetCredit(): value out of range"); - } - return nCredit; - } - CAmount GetChange(const CTransaction& tx) const - { - CAmount nChange = 0; - BOOST_FOREACH(const CTxOut& txout, tx.vout) - { - nChange += GetChange(txout); - if (!MoneyRange(nChange)) - throw std::runtime_error("CWallet::GetChange(): value out of range"); - } - return nChange; - } + bool IsFromMe(const CTransaction& tx) const; + CAmount GetDebit(const CTransaction& tx, const isminefilter& filter) const; + CAmount GetCredit(const CTransaction& tx, const isminefilter& filter) const; + CAmount GetChange(const CTransaction& tx) const; void SetBestChain(const CBlockLocator& loc); DBErrors LoadWallet(bool& fFirstRunRet); |