diff options
author | ishaanam <ishaana.misra@gmail.com> | 2023-04-18 14:42:18 -0400 |
---|---|---|
committer | ishaanam <ishaana.misra@gmail.com> | 2023-04-22 09:19:24 -0400 |
commit | 096487c4dcfadebe5ca959927f5426cae1c304d5 (patch) | |
tree | 1b2a7118a8c0bcb6978f1298c501a3d9022f7248 /src/wallet/wallet.h | |
parent | 49d07ea9a1a251b44e849ebbaf91857cff0bd22a (diff) |
wallet: introduce generic recursive tx state updating function
This commit also changed `MarkConflicted` and `AbandonTransaction`
to use this new function
Co-authored-by: ariard <antoine.riard@gmail.com>
Diffstat (limited to 'src/wallet/wallet.h')
-rw-r--r-- | src/wallet/wallet.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/wallet/wallet.h b/src/wallet/wallet.h index 581a6bd9cb..e304570fc8 100644 --- a/src/wallet/wallet.h +++ b/src/wallet/wallet.h @@ -325,6 +325,13 @@ private: /** Mark a transaction (and its in-wallet descendants) as conflicting with a particular block. */ void MarkConflicted(const uint256& hashBlock, int conflicting_height, const uint256& hashTx); + enum class TxUpdate { UNCHANGED, CHANGED, NOTIFY_CHANGED }; + + using TryUpdatingStateFn = std::function<TxUpdate(CWalletTx& wtx)>; + + /** Mark a transaction (and its in-wallet descendants) as a particular tx state. */ + void RecursiveUpdateTxState(const uint256& tx_hash, const TryUpdatingStateFn& try_updating_state) EXCLUSIVE_LOCKS_REQUIRED(cs_wallet); + /** Mark a transaction's inputs dirty, thus forcing the outputs to be recomputed */ void MarkInputsDirty(const CTransactionRef& tx) EXCLUSIVE_LOCKS_REQUIRED(cs_wallet); |