@@ -966,8 +966,9 @@ bool CWallet::LoadToWallet(const CWalletTx& wtxIn)
966
966
* Abandoned state should probably be more carefully tracked via different
967
967
* posInBlock signals or by checking mempool presence when necessary.
968
968
*/
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 )
970
970
{
971
+ const CTransaction& tx = *ptx;
971
972
{
972
973
AssertLockHeld (cs_wallet);
973
974
@@ -988,7 +989,7 @@ bool CWallet::AddToWalletIfInvolvingMe(const CTransaction& tx, const CBlockIndex
988
989
if (fExisted && !fUpdate ) return false ;
989
990
if (fExisted || IsMine (tx) || IsFromMe (tx))
990
991
{
991
- CWalletTx wtx (this , MakeTransactionRef (tx) );
992
+ CWalletTx wtx (this , ptx );
992
993
993
994
// Get merkle branch if transaction was found in a block
994
995
if (posInBlock != -1 )
@@ -1119,7 +1120,7 @@ void CWallet::MarkConflicted(const uint256& hashBlock, const uint256& hashTx)
1119
1120
void CWallet::SyncTransaction (const CTransactionRef& ptx, const CBlockIndex *pindexBlockConnected, int posInBlock) {
1120
1121
const CTransaction& tx = *ptx;
1121
1122
1122
- if (!AddToWalletIfInvolvingMe (tx , pindexBlockConnected, posInBlock, true ))
1123
+ if (!AddToWalletIfInvolvingMe (ptx , pindexBlockConnected, posInBlock, true ))
1123
1124
return ; // Not one of ours
1124
1125
1125
1126
// If a transaction changes 'conflicted' state, that changes the balance
@@ -1542,7 +1543,7 @@ CBlockIndex* CWallet::ScanForWalletTransactions(CBlockIndex* pindexStart, bool f
1542
1543
CBlock block;
1543
1544
if (ReadBlockFromDisk (block, pindex, Params ().GetConsensus ())) {
1544
1545
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 );
1546
1547
}
1547
1548
if (!ret) {
1548
1549
ret = pindex;
0 commit comments