@@ -957,9 +957,9 @@ bool CWallet::LoadToWallet(const CWalletTx& wtxIn)
957
957
/* *
958
958
* Add a transaction to the wallet, or update it. pIndex and posInBlock should
959
959
* 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
+ *
963
963
* If fUpdate is true, existing transactions will be updated.
964
964
* TODO: One exception to this is that the abandoned state is cleared under the
965
965
* assumption that any further notification of a transaction that was considered
@@ -973,7 +973,7 @@ bool CWallet::AddToWalletIfInvolvingMe(const CTransactionRef& ptx, const CBlockI
973
973
{
974
974
AssertLockHeld (cs_wallet);
975
975
976
- if (posInBlock != - 1 ) {
976
+ if (pIndex != NULL ) {
977
977
BOOST_FOREACH (const CTxIn& txin, tx.vin ) {
978
978
std::pair<TxSpends::const_iterator, TxSpends::const_iterator> range = mapTxSpends.equal_range (txin.prevout );
979
979
while (range.first != range.second ) {
@@ -993,7 +993,7 @@ bool CWallet::AddToWalletIfInvolvingMe(const CTransactionRef& ptx, const CBlockI
993
993
CWalletTx wtx (this , ptx);
994
994
995
995
// Get merkle branch if transaction was found in a block
996
- if (posInBlock != - 1 )
996
+ if (pIndex != NULL )
997
997
wtx.SetMerkleBranch (pIndex, posInBlock);
998
998
999
999
return AddToWallet (wtx, false );
@@ -1118,10 +1118,10 @@ void CWallet::MarkConflicted(const uint256& hashBlock, const uint256& hashTx)
1118
1118
}
1119
1119
}
1120
1120
1121
- void CWallet::SyncTransaction (const CTransactionRef& ptx, const CBlockIndex *pindexBlockConnected , int posInBlock) {
1121
+ void CWallet::SyncTransaction (const CTransactionRef& ptx, const CBlockIndex *pindex , int posInBlock) {
1122
1122
const CTransaction& tx = *ptx;
1123
1123
1124
- if (!AddToWalletIfInvolvingMe (ptx, pindexBlockConnected , posInBlock, true ))
1124
+ if (!AddToWalletIfInvolvingMe (ptx, pindex , posInBlock, true ))
1125
1125
return ; // Not one of ours
1126
1126
1127
1127
// If a transaction changes 'conflicted' state, that changes the balance
@@ -1136,7 +1136,7 @@ void CWallet::SyncTransaction(const CTransactionRef& ptx, const CBlockIndex *pin
1136
1136
1137
1137
void CWallet::TransactionAddedToMempool (const CTransactionRef& ptx) {
1138
1138
LOCK2 (cs_main, cs_wallet);
1139
- SyncTransaction (ptx, NULL , - 1 );
1139
+ SyncTransaction (ptx);
1140
1140
}
1141
1141
1142
1142
void CWallet::BlockConnected (const std::shared_ptr<const CBlock>& pblock, const CBlockIndex *pindex, const std::vector<CTransactionRef>& vtxConflicted) {
@@ -1150,7 +1150,7 @@ void CWallet::BlockConnected(const std::shared_ptr<const CBlock>& pblock, const
1150
1150
// the notification that the conflicted transaction was evicted.
1151
1151
1152
1152
for (const CTransactionRef& ptx : vtxConflicted) {
1153
- SyncTransaction (ptx, NULL , - 1 );
1153
+ SyncTransaction (ptx);
1154
1154
}
1155
1155
for (size_t i = 0 ; i < pblock->vtx .size (); i++) {
1156
1156
SyncTransaction (pblock->vtx [i], pindex, i);
@@ -1161,7 +1161,7 @@ void CWallet::BlockDisconnected(const std::shared_ptr<const CBlock>& pblock) {
1161
1161
LOCK2 (cs_main, cs_wallet);
1162
1162
1163
1163
for (const CTransactionRef& ptx : pblock->vtx ) {
1164
- SyncTransaction (ptx, NULL , - 1 );
1164
+ SyncTransaction (ptx);
1165
1165
}
1166
1166
}
1167
1167
0 commit comments