Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/wallet.h
Show First 20 Lines • Show All 312 Lines • ▼ Show 20 Lines | enum AmountType { | ||||
CREDIT, | CREDIT, | ||||
IMMATURE_CREDIT, | IMMATURE_CREDIT, | ||||
AVAILABLE_CREDIT, | AVAILABLE_CREDIT, | ||||
AMOUNTTYPE_ENUM_ELEMENTS | AMOUNTTYPE_ENUM_ELEMENTS | ||||
}; | }; | ||||
Amount GetCachableAmount(AmountType type, const isminefilter &filter, | Amount GetCachableAmount(AmountType type, const isminefilter &filter, | ||||
bool recalculate = false) const; | bool recalculate = false) const; | ||||
mutable CachableAmount m_amounts[AMOUNTTYPE_ENUM_ELEMENTS]; | mutable CachableAmount m_amounts[AMOUNTTYPE_ENUM_ELEMENTS]; | ||||
/** | |||||
* This flag is true if all m_amounts caches are empty. This is particularly | |||||
* useful in places where MarkDirty is conditionally called and the | |||||
* condition can be expensive and thus can be skipped if the flag is true. | |||||
* See MarkDestinationsDirty. | |||||
*/ | |||||
mutable bool m_is_cache_empty{true}; | |||||
mutable bool fChangeCached; | mutable bool fChangeCached; | ||||
mutable bool fInMempool; | mutable bool fInMempool; | ||||
mutable Amount nChangeCached; | mutable Amount nChangeCached; | ||||
CWalletTx(const CWallet *pwalletIn, CTransactionRef arg) | CWalletTx(const CWallet *pwalletIn, CTransactionRef arg) | ||||
: tx(std::move(arg)) { | : tx(std::move(arg)) { | ||||
Init(pwalletIn); | Init(pwalletIn); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 117 Lines • ▼ Show 20 Lines | public: | ||||
//! make sure balances are recalculated | //! make sure balances are recalculated | ||||
void MarkDirty() { | void MarkDirty() { | ||||
m_amounts[DEBIT].Reset(); | m_amounts[DEBIT].Reset(); | ||||
m_amounts[CREDIT].Reset(); | m_amounts[CREDIT].Reset(); | ||||
m_amounts[IMMATURE_CREDIT].Reset(); | m_amounts[IMMATURE_CREDIT].Reset(); | ||||
m_amounts[AVAILABLE_CREDIT].Reset(); | m_amounts[AVAILABLE_CREDIT].Reset(); | ||||
fChangeCached = false; | fChangeCached = false; | ||||
m_is_cache_empty = true; | |||||
} | } | ||||
void BindWallet(CWallet *pwalletIn) { | void BindWallet(CWallet *pwalletIn) { | ||||
pwallet = pwalletIn; | pwallet = pwalletIn; | ||||
MarkDirty(); | MarkDirty(); | ||||
} | } | ||||
//! filter decides which addresses will count towards the debit | //! filter decides which addresses will count towards the debit | ||||
▲ Show 20 Lines • Show All 992 Lines • Show Last 20 Lines |