Skip to content

Commit 17e6aa8

Browse files
committed
Privatize CWallet::AddToWalletIfInvolvingMe
And document in the header.
1 parent b7f5650 commit 17e6aa8

File tree

2 files changed

+15
-14
lines changed

2 files changed

+15
-14
lines changed

src/wallet/wallet.cpp

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1028,19 +1028,6 @@ bool CWallet::LoadToWallet(const CWalletTx& wtxIn)
10281028
return true;
10291029
}
10301030

1031-
/**
1032-
* Add a transaction to the wallet, or update it. pIndex and posInBlock should
1033-
* be set when the transaction was known to be included in a block. When
1034-
* pIndex == nullptr, then wallet state is not updated in AddToWallet, but
1035-
* notifications happen and cached balances are marked dirty.
1036-
*
1037-
* If fUpdate is true, existing transactions will be updated.
1038-
* TODO: One exception to this is that the abandoned state is cleared under the
1039-
* assumption that any further notification of a transaction that was considered
1040-
* abandoned is an indication that it is not safe to be considered abandoned.
1041-
* Abandoned state should probably be more carefully tracked via different
1042-
* posInBlock signals or by checking mempool presence when necessary.
1043-
*/
10441031
bool CWallet::AddToWalletIfInvolvingMe(const CTransactionRef& ptx, const CBlockIndex* pIndex, int posInBlock, bool fUpdate)
10451032
{
10461033
const CTransaction& tx = *ptx;

src/wallet/wallet.h

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -703,6 +703,21 @@ class CWallet final : public CCryptoKeyStore, public CValidationInterface
703703
void AddToSpends(const COutPoint& outpoint, const uint256& wtxid);
704704
void AddToSpends(const uint256& wtxid);
705705

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+
706721
/* Mark a transaction (and its in-wallet descendants) as conflicting with a particular block. */
707722
void MarkConflicted(const uint256& hashBlock, const uint256& hashTx);
708723

@@ -937,7 +952,6 @@ class CWallet final : public CCryptoKeyStore, public CValidationInterface
937952
void TransactionAddedToMempool(const CTransactionRef& tx) override;
938953
void BlockConnected(const std::shared_ptr<const CBlock>& pblock, const CBlockIndex *pindex, const std::vector<CTransactionRef>& vtxConflicted) override;
939954
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);
941955
int64_t RescanFromTime(int64_t startTime, const WalletRescanReserver& reserver, bool update);
942956
CBlockIndex* ScanForWalletTransactions(CBlockIndex* pindexStart, CBlockIndex* pindexStop, const WalletRescanReserver& reserver, bool fUpdate = false);
943957
void TransactionRemovedFromMempool(const CTransactionRef &ptx) override;

0 commit comments

Comments
 (0)