Fix crashes when anonymizing Spark #1736
Draft
+32
−11
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Wallet crashes at times when clicking on Anonymize All or when sending transparent balance to a Spark Address that you own.
PR intention
DeleteMe: Mandatory: What this PR is intended to do, what change it introduces, what issue it solves.
Complete Summary of All Bugs Fixed
Critical Bug (from PR #1734): Uninitialized Transaction in sparkwallet.cpp
Location: src/spark/sparkwallet.cpp, line 1206
Problem: The code was calling mempool.IsTransactionAllowed(*wtx.tx, state) where wtx.tx was still pointing to an empty/uninitialized transaction. The actual signed transaction (txNewConst) was created at line 1186, but wtx.tx is only set at line 1212 (AFTER the mempool check).
Root Cause: When mempool.IsTransactionAllowed() tried to access fields of the empty transaction, it caused EXCEPTION_ACCESS_VIOLATION.
Fix: Changed to use txNewConst (the actual signed transaction) instead of *wtx.tx.
Note
Resolves crashes when sending/minting Spark by hardening wallet/Qt code and fixing a critical mempool check.
txNewConst) formempool.IsTransactionAllowedinsparkwallet.cppto avoid accessing an uninitializedwtx.txpwalletMain->sparkWalletbefore accessing Spark data inwallet.cpp,transactionrecord.cpp,walletmodeltransaction.cpp, andsparkmodel.cppEnsureMintWalletAvailable()withEnsureSparkWalletAvailable()in Spark spend/name creation; add early null check inCreateSparkMintTransactionssendcoinsdialog.cpp, callSendCoinsEntry::generateWarningTextstatically and update allSendCoinsEntrywidgets when toggling anonymize modeWritten by Cursor Bugbot for commit f31778a. This will update automatically on new commits. Configure here.