Wallet: Keep transaction removal indexes consistent - #1927
Draft
reubenyap wants to merge 1 commit into
Draft
Conversation
Clean derived wallet indexes before erasing a CWalletTx, and commit batched database deletions before applying matching memory changes. Add coverage for both removal entry points, competing spends, balances, reloads, ordered pointers, and database failure.
Contributor
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: trueThanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
PR intention
Fix direct wallet transaction deletion so
mapWallet,wtxOrdered,mapTxSpends,setWalletUTXO, and cached balances remain consistent.This is a standalone fix from #1896. It does not change
AbandonTransaction. Because #1896 has not merged, this PR includes the minimalMarkDirty()calls needed after successful deletion; that is the only intended overlap and may require conflict resolution if #1896 lands first.Code changes brief
EraseFromWalletandZapSelectTx.Validation:
cmake --build build-removal --target test_firo -j4test_firo.exe --run_test=wallet_tx_removal_tests --catch_system_error=no --log_level=test_suite -- DEBUG_LOG_OUTtest_firo.exe --run_test=wallet_tests --catch_system_error=no --log_level=test_suite -- DEBUG_LOG_OUTtest_firo.exe --run_test=spark_wallet_tests --catch_system_error=no --log_level=test_suite -- DEBUG_LOG_OUTcmake --build build-removal --target firod firo-cli -j4python qa/rpc-tests/importprunedfunds.py --nocleanupgit diff --checkAll patched commands passed on Windows MinGW. The RPC test used
--nocleanuponly to avoid the framework's Windows open-log cleanup error. Python 3.12 used pinnedpyasyncore==1.0.5because the legacy test framework imports the removed standard-library module.Limitation: database failure coverage injects transaction-start failure. It does not artificially inject a mid-erase or commit failure.