diff --git a/src/wallet/wallet.h b/src/wallet/wallet.h --- a/src/wallet/wallet.h +++ b/src/wallet/wallet.h @@ -747,13 +747,14 @@ void SyncMetaData(std::pair); /** - * Used by TransactionAddedToMemorypool/BlockConnected/Disconnected. + * Used by + * TransactionAddedToMemorypool/BlockConnected/Disconnected/ScanForWalletTransactions. * Should be called with pindexBlock and posInBlock if this is for a * transaction that is included in a block. */ void SyncTransaction(const CTransactionRef &tx, const CBlockIndex *pindex = nullptr, - int posInBlock = 0) + int posInBlock = 0, bool update_tx = true) EXCLUSIVE_LOCKS_REQUIRED(cs_wallet); /* the HD chain data model (external chain counters) */ diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -1297,10 +1297,11 @@ } void CWallet::SyncTransaction(const CTransactionRef &ptx, - const CBlockIndex *pindex, int posInBlock) { + const CBlockIndex *pindex, int posInBlock, + bool update_tx) { const CTransaction &tx = *ptx; - if (!AddToWalletIfInvolvingMe(ptx, pindex, posInBlock, true)) { + if (!AddToWalletIfInvolvingMe(ptx, pindex, posInBlock, update_tx)) { // Not one of ours return; } @@ -1904,8 +1905,8 @@ } for (size_t posInBlock = 0; posInBlock < block.vtx.size(); ++posInBlock) { - AddToWalletIfInvolvingMe(block.vtx[posInBlock], pindex, - posInBlock, fUpdate); + SyncTransaction(block.vtx[posInBlock], pindex, posInBlock, + fUpdate); } } else { ret = pindex;