Skip to content

Commit 714e4ad

Browse files
committed
AddToWalletIfInvolvingMe should test pIndex, not posInBlock
1 parent 67023e9 commit 714e4ad

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/wallet/wallet.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -957,9 +957,9 @@ bool CWallet::LoadToWallet(const CWalletTx& wtxIn)
957957
/**
958958
* Add a transaction to the wallet, or update it. pIndex and posInBlock should
959959
* be set when the transaction was known to be included in a block. When
960-
* posInBlock = SYNC_TRANSACTION_NOT_IN_BLOCK (-1) , then wallet state is not
961-
* updated in AddToWallet, but notifications happen and cached balances are
962-
* marked dirty.
960+
* pIndex == NULL, then wallet state is not updated in AddToWallet, but
961+
* notifications happen and cached balances are marked dirty.
962+
*
963963
* If fUpdate is true, existing transactions will be updated.
964964
* TODO: One exception to this is that the abandoned state is cleared under the
965965
* assumption that any further notification of a transaction that was considered
@@ -973,7 +973,7 @@ bool CWallet::AddToWalletIfInvolvingMe(const CTransactionRef& ptx, const CBlockI
973973
{
974974
AssertLockHeld(cs_wallet);
975975

976-
if (posInBlock != -1) {
976+
if (pIndex != NULL) {
977977
BOOST_FOREACH(const CTxIn& txin, tx.vin) {
978978
std::pair<TxSpends::const_iterator, TxSpends::const_iterator> range = mapTxSpends.equal_range(txin.prevout);
979979
while (range.first != range.second) {
@@ -993,7 +993,7 @@ bool CWallet::AddToWalletIfInvolvingMe(const CTransactionRef& ptx, const CBlockI
993993
CWalletTx wtx(this, ptx);
994994

995995
// Get merkle branch if transaction was found in a block
996-
if (posInBlock != -1)
996+
if (pIndex != NULL)
997997
wtx.SetMerkleBranch(pIndex, posInBlock);
998998

999999
return AddToWallet(wtx, false);

0 commit comments

Comments
 (0)