diff --git a/src/wallet/wallet.h b/src/wallet/wallet.h --- a/src/wallet/wallet.h +++ b/src/wallet/wallet.h @@ -738,6 +738,26 @@ void AddToSpends(const COutPoint &outpoint, const TxId &wtxid); void AddToSpends(const TxId &wtxid); + /** + * Add a transaction to the wallet, or update it. pIndex and posInBlock + * should be set when the transaction was known to be included in a + * block. When *pIndex == nullptr, then wallet state is not updated in + * AddToWallet, but notifications happen and cached balances are marked + * dirty. + * + * If fUpdate is true, existing transactions will be updated. + * TODO: One exception to this is that the abandoned state is cleared under + * the assumption that any further notification of a transaction that was + * considered abandoned is an indication that it is not safe to be + * considered abandoned. Abandoned state should probably be more carefully + * tracked via different posInBlock signals or by checking mempool presence + * when necessary. + */ + bool AddToWalletIfInvolvingMe(const CTransactionRef &tx, + const CBlockIndex *pIndex, int posInBlock, + bool fUpdate) + EXCLUSIVE_LOCKS_REQUIRED(cs_wallet); + /** * Mark a transaction (and its in-wallet descendants) as conflicting with a * particular block. @@ -1059,10 +1079,6 @@ const std::vector &vtxConflicted) override; void BlockDisconnected(const std::shared_ptr &pblock) override; - bool AddToWalletIfInvolvingMe(const CTransactionRef &tx, - const CBlockIndex *pIndex, int posInBlock, - bool fUpdate) - EXCLUSIVE_LOCKS_REQUIRED(cs_wallet); int64_t RescanFromTime(int64_t startTime, const WalletRescanReserver &reserver, bool update); CBlockIndex *ScanForWalletTransactions(CBlockIndex *pindexStart, diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -1073,19 +1073,6 @@ } } -/** - * Add a transaction to the wallet, or update it. pIndex and posInBlock should - * be set when the transaction was known to be included in a block. When pIndex - * == nullptr, then wallet state is not updated in AddToWallet, but - * notifications happen and cached balances are marked dirty. - * - * If fUpdate is true, existing transactions will be updated. - * TODO: One exception to this is that the abandoned state is cleared under the - * assumption that any further notification of a transaction that was considered - * abandoned is an indication that it is not safe to be considered abandoned. - * Abandoned state should probably be more carefully tracked via different - * posInBlock signals or by checking mempool presence when necessary. - */ bool CWallet::AddToWalletIfInvolvingMe(const CTransactionRef &ptx, const CBlockIndex *pIndex, int posInBlock, bool fUpdate) {