Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/wallet.h
Show First 20 Lines • Show All 382 Lines • ▼ Show 20 Lines | public: | ||||
* externally and came in through the network or sendrawtransaction RPC. | * externally and came in through the network or sendrawtransaction RPC. | ||||
*/ | */ | ||||
char fFromMe; | char fFromMe; | ||||
//! position in ordered transaction list | //! position in ordered transaction list | ||||
int64_t nOrderPos; | int64_t nOrderPos; | ||||
std::multimap<int64_t, CWalletTx *>::const_iterator m_it_wtxOrdered; | std::multimap<int64_t, CWalletTx *>::const_iterator m_it_wtxOrdered; | ||||
// memory only | // memory only | ||||
mutable bool fDebitCached; | enum AmountType { | ||||
mutable bool fCreditCached; | DEBIT, | ||||
mutable bool fImmatureCreditCached; | CREDIT, | ||||
mutable bool fAvailableCreditCached; | IMMATURE_CREDIT, | ||||
mutable bool fWatchDebitCached; | AVAILABLE_CREDIT, | ||||
mutable bool fWatchCreditCached; | AMOUNTTYPE_ENUM_ELEMENTS | ||||
mutable bool fImmatureWatchCreditCached; | }; | ||||
mutable bool fAvailableWatchCreditCached; | Amount GetCachableAmount(AmountType type, const isminefilter &filter, | ||||
bool recalculate = false) const; | |||||
mutable CachableAmount m_amounts[AMOUNTTYPE_ENUM_ELEMENTS]; | |||||
mutable bool fChangeCached; | mutable bool fChangeCached; | ||||
mutable bool fInMempool; | mutable bool fInMempool; | ||||
mutable Amount nDebitCached; | |||||
mutable Amount nCreditCached; | |||||
mutable Amount nImmatureCreditCached; | |||||
mutable Amount nAvailableCreditCached; | |||||
mutable Amount nWatchDebitCached; | |||||
mutable Amount nWatchCreditCached; | |||||
mutable Amount nImmatureWatchCreditCached; | |||||
mutable Amount nAvailableWatchCreditCached; | |||||
mutable Amount nChangeCached; | mutable Amount nChangeCached; | ||||
CWalletTx(const CWallet *pwalletIn, CTransactionRef arg) | CWalletTx(const CWallet *pwalletIn, CTransactionRef arg) | ||||
: CMerkleTx(std::move(arg)) { | : CMerkleTx(std::move(arg)) { | ||||
Init(pwalletIn); | Init(pwalletIn); | ||||
} | } | ||||
void Init(const CWallet *pwalletIn) { | void Init(const CWallet *pwalletIn) { | ||||
pwallet = pwalletIn; | pwallet = pwalletIn; | ||||
mapValue.clear(); | mapValue.clear(); | ||||
vOrderForm.clear(); | vOrderForm.clear(); | ||||
fTimeReceivedIsTxTime = false; | fTimeReceivedIsTxTime = false; | ||||
nTimeReceived = 0; | nTimeReceived = 0; | ||||
nTimeSmart = 0; | nTimeSmart = 0; | ||||
fFromMe = false; | fFromMe = false; | ||||
fDebitCached = false; | |||||
fCreditCached = false; | |||||
fImmatureCreditCached = false; | |||||
fAvailableCreditCached = false; | |||||
fWatchDebitCached = false; | |||||
fWatchCreditCached = false; | |||||
fImmatureWatchCreditCached = false; | |||||
fAvailableWatchCreditCached = false; | |||||
fChangeCached = false; | fChangeCached = false; | ||||
fInMempool = false; | fInMempool = false; | ||||
nDebitCached = Amount::zero(); | |||||
nCreditCached = Amount::zero(); | |||||
nImmatureCreditCached = Amount::zero(); | |||||
nAvailableCreditCached = Amount::zero(); | |||||
nWatchDebitCached = Amount::zero(); | |||||
nWatchCreditCached = Amount::zero(); | |||||
nAvailableWatchCreditCached = Amount::zero(); | |||||
nImmatureWatchCreditCached = Amount::zero(); | |||||
nChangeCached = Amount::zero(); | nChangeCached = Amount::zero(); | ||||
nOrderPos = -1; | nOrderPos = -1; | ||||
} | } | ||||
template <typename Stream> void Serialize(Stream &s) const { | template <typename Stream> void Serialize(Stream &s) const { | ||||
char fSpent = false; | char fSpent = false; | ||||
mapValue_t mapValueCopy = mapValue; | mapValue_t mapValueCopy = mapValue; | ||||
Show All 28 Lines | template <typename Stream> void Unserialize(Stream &s) { | ||||
mapValue.erase("fromaccount"); | mapValue.erase("fromaccount"); | ||||
mapValue.erase("spent"); | mapValue.erase("spent"); | ||||
mapValue.erase("n"); | mapValue.erase("n"); | ||||
mapValue.erase("timesmart"); | mapValue.erase("timesmart"); | ||||
} | } | ||||
//! make sure balances are recalculated | //! make sure balances are recalculated | ||||
void MarkDirty() { | void MarkDirty() { | ||||
fCreditCached = false; | m_amounts[DEBIT].Reset(); | ||||
fAvailableCreditCached = false; | m_amounts[CREDIT].Reset(); | ||||
fImmatureCreditCached = false; | m_amounts[IMMATURE_CREDIT].Reset(); | ||||
fWatchDebitCached = false; | m_amounts[AVAILABLE_CREDIT].Reset(); | ||||
fWatchCreditCached = false; | |||||
fAvailableWatchCreditCached = false; | |||||
fImmatureWatchCreditCached = false; | |||||
fDebitCached = false; | |||||
fChangeCached = false; | fChangeCached = false; | ||||
} | } | ||||
void BindWallet(CWallet *pwalletIn) { | void BindWallet(CWallet *pwalletIn) { | ||||
pwallet = pwalletIn; | pwallet = pwalletIn; | ||||
MarkDirty(); | MarkDirty(); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 1,048 Lines • Show Last 20 Lines |