aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/wallet.h
diff options
context:
space:
mode:
authorJoão Barbosa <joao.paulo.barbosa@gmail.com>2020-01-07 13:47:20 +0000
committerJoão Barbosa <joao.paulo.barbosa@gmail.com>2020-01-17 01:12:17 +0000
commit2b1641492fbf81e2c5a95f3e580811ca8700adc5 (patch)
tree270d29293a5c8fa2bb7c81461102ea5725e3815b /src/wallet/wallet.h
parentac61ec9da6793f00b29ba11f784b9b1c3ae662e9 (diff)
wallet: Improve CWallet:MarkDestinationsDirty
Diffstat (limited to 'src/wallet/wallet.h')
-rw-r--r--src/wallet/wallet.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/wallet/wallet.h b/src/wallet/wallet.h
index 846a502614..6835f33b52 100644
--- a/src/wallet/wallet.h
+++ b/src/wallet/wallet.h
@@ -313,6 +313,13 @@ public:
enum AmountType { DEBIT, CREDIT, IMMATURE_CREDIT, AVAILABLE_CREDIT, AMOUNTTYPE_ENUM_ELEMENTS };
CAmount GetCachableAmount(AmountType type, const isminefilter& filter, bool recalculate = false) const;
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 fInMempool;
mutable CAmount nChangeCached;
@@ -439,6 +446,7 @@ public:
m_amounts[IMMATURE_CREDIT].Reset();
m_amounts[AVAILABLE_CREDIT].Reset();
fChangeCached = false;
+ m_is_cache_empty = true;
}
void BindWallet(CWallet *pwalletIn)