@@ -966,8 +966,9 @@ bool CWallet::LoadToWallet(const CWalletTx& wtxIn)
966966 * Abandoned state should probably be more carefully tracked via different
967967 * posInBlock signals or by checking mempool presence when necessary.
968968 */
969- bool CWallet::AddToWalletIfInvolvingMe (const CTransaction& tx , const CBlockIndex* pIndex, int posInBlock, bool fUpdate )
969+ bool CWallet::AddToWalletIfInvolvingMe (const CTransactionRef& ptx , const CBlockIndex* pIndex, int posInBlock, bool fUpdate )
970970{
971+ const CTransaction& tx = *ptx;
971972 {
972973 AssertLockHeld (cs_wallet);
973974
@@ -988,7 +989,7 @@ bool CWallet::AddToWalletIfInvolvingMe(const CTransaction& tx, const CBlockIndex
988989 if (fExisted && !fUpdate ) return false ;
989990 if (fExisted || IsMine (tx) || IsFromMe (tx))
990991 {
991- CWalletTx wtx (this , MakeTransactionRef (tx) );
992+ CWalletTx wtx (this , ptx );
992993
993994 // Get merkle branch if transaction was found in a block
994995 if (posInBlock != -1 )
@@ -1119,7 +1120,7 @@ void CWallet::MarkConflicted(const uint256& hashBlock, const uint256& hashTx)
11191120void CWallet::SyncTransaction (const CTransactionRef& ptx, const CBlockIndex *pindexBlockConnected, int posInBlock) {
11201121 const CTransaction& tx = *ptx;
11211122
1122- if (!AddToWalletIfInvolvingMe (tx , pindexBlockConnected, posInBlock, true ))
1123+ if (!AddToWalletIfInvolvingMe (ptx , pindexBlockConnected, posInBlock, true ))
11231124 return ; // Not one of ours
11241125
11251126 // If a transaction changes 'conflicted' state, that changes the balance
@@ -1542,7 +1543,7 @@ CBlockIndex* CWallet::ScanForWalletTransactions(CBlockIndex* pindexStart, bool f
15421543 CBlock block;
15431544 if (ReadBlockFromDisk (block, pindex, Params ().GetConsensus ())) {
15441545 for (size_t posInBlock = 0 ; posInBlock < block.vtx .size (); ++posInBlock) {
1545- AddToWalletIfInvolvingMe (* block.vtx [posInBlock], pindex, posInBlock, fUpdate );
1546+ AddToWalletIfInvolvingMe (block.vtx [posInBlock], pindex, posInBlock, fUpdate );
15461547 }
15471548 if (!ret) {
15481549 ret = pindex;
0 commit comments