@@ -703,6 +703,21 @@ class CWallet final : public CCryptoKeyStore, public CValidationInterface
703
703
void AddToSpends (const COutPoint& outpoint, const uint256& wtxid);
704
704
void AddToSpends (const uint256& wtxid);
705
705
706
+ /* *
707
+ * Add a transaction to the wallet, or update it. pIndex and posInBlock should
708
+ * be set when the transaction was known to be included in a block. When
709
+ * pIndex == nullptr, then wallet state is not updated in AddToWallet, but
710
+ * notifications happen and cached balances are marked dirty.
711
+ *
712
+ * If fUpdate is true, existing transactions will be updated.
713
+ * TODO: One exception to this is that the abandoned state is cleared under the
714
+ * assumption that any further notification of a transaction that was considered
715
+ * abandoned is an indication that it is not safe to be considered abandoned.
716
+ * Abandoned state should probably be more carefully tracked via different
717
+ * posInBlock signals or by checking mempool presence when necessary.
718
+ */
719
+ bool AddToWalletIfInvolvingMe (const CTransactionRef& tx, const CBlockIndex* pIndex, int posInBlock, bool fUpdate ) EXCLUSIVE_LOCKS_REQUIRED(cs_wallet);
720
+
706
721
/* Mark a transaction (and its in-wallet descendants) as conflicting with a particular block. */
707
722
void MarkConflicted (const uint256& hashBlock, const uint256& hashTx);
708
723
@@ -937,7 +952,6 @@ class CWallet final : public CCryptoKeyStore, public CValidationInterface
937
952
void TransactionAddedToMempool (const CTransactionRef& tx) override ;
938
953
void BlockConnected (const std::shared_ptr<const CBlock>& pblock, const CBlockIndex *pindex, const std::vector<CTransactionRef>& vtxConflicted) override ;
939
954
void BlockDisconnected (const std::shared_ptr<const CBlock>& pblock) override ;
940
- bool AddToWalletIfInvolvingMe (const CTransactionRef& tx, const CBlockIndex* pIndex, int posInBlock, bool fUpdate ) EXCLUSIVE_LOCKS_REQUIRED(cs_wallet);
941
955
int64_t RescanFromTime (int64_t startTime, const WalletRescanReserver& reserver, bool update);
942
956
CBlockIndex* ScanForWalletTransactions (CBlockIndex* pindexStart, CBlockIndex* pindexStop, const WalletRescanReserver& reserver, bool fUpdate = false );
943
957
void TransactionRemovedFromMempool (const CTransactionRef &ptx) override ;
0 commit comments