wallet: remove update_tx argument from SyncTransaction
What changed, and why it matters
This is a small internal cleanup in Bitcoin Core's wallet code. A function called SyncTransaction had an optional setting (update_tx) that was always being passed as 'true', so the developers removed that setting and hardcoded 'true' instead. There is no change in behavior and no security issue.
No action needed; this is a non-security refactoring change.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The commit refactors CWallet::SyncTransaction by removing the bool update_tx parameter and its default value, since every call site passed true. The parameter is now passed as a literal /fUpdate=/true to AddToWalletIfInvolvingMe. The call in ScanForWalletTransactions is updated accordingly. This is a pure code-quality refactor with no functional change.
Changed components
src/wallet/wallet.cppsrc/wallet/wallet.hInspect captured patch +4 / −4
diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp
index 737b77f2..f46c7428 100644
--- a/src/wallet/wallet.cpp
+++ b/src/wallet/wallet.cpp
@@ -1413,9 +1413,9 @@ void CWallet::RecursiveUpdateTxState(WalletBatch* batch, const Txid& tx_hash, co
}
}
-bool CWallet::SyncTransaction(const CTransactionRef& ptx, const SyncTxState& state, bool update_tx, bool rescanning_old_block)
+bool CWallet::SyncTransaction(const CTransactionRef& ptx, const SyncTxState& state, bool rescanning_old_block)
{
- if (!AddToWalletIfInvolvingMe(ptx, state, update_tx, rescanning_old_block))
+ if (!AddToWalletIfInvolvingMe(ptx, state, /*fUpdate=*/true, rescanning_old_block))
return false; // Not one of ours
// If a transaction changes 'conflicted' state, that changes the balance
@@ -1952,7 +1952,7 @@ CWallet::ScanResult CWallet::ScanForWalletTransactions(const uint256& start_bloc
break;
}
for (size_t posInBlock = 0; posInBlock < block.vtx.size(); ++posInBlock) {
- SyncTransaction(block.vtx[posInBlock], TxStateConfirmed{block_hash, block_height, static_cast<int>(posInBlock)}, /*update_tx=*/true, /*rescanning_old_block=*/true);
+ SyncTransaction(block.vtx[posInBlock], TxStateConfirmed{block_hash, block_height, static_cast<int>(posInBlock)}, /*rescanning_old_block=*/true);
}
// scan succeeded, record block as most recent successfully scanned
result.last_scanned_block = block_hash;
diff --git a/src/wallet/wallet.h b/src/wallet/wallet.h
index 45d5e1c7..180668ad 100644
--- a/src/wallet/wallet.h
+++ b/src/wallet/wallet.h
@@ -375,7 +375,7 @@ private:
void SyncMetaData(std::pair<TxSpends::iterator, TxSpends::iterator>) EXCLUSIVE_LOCKS_REQUIRED(cs_wallet);
- bool SyncTransaction(const CTransactionRef& tx, const SyncTxState& state, bool update_tx = true, bool rescanning_old_block = false) EXCLUSIVE_LOCKS_REQUIRED(cs_wallet);
+ bool SyncTransaction(const CTransactionRef& tx, const SyncTxState& state, bool rescanning_old_block = false) EXCLUSIVE_LOCKS_REQUIRED(cs_wallet);
/** WalletFlags set on this wallet. */
std::atomic<uint64_t> m_wallet_flags{0};
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.