mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-09-12 05:32:22 +02:00
2818a171c0test: add abortscan unit test (Pol Espinasa)bc30e95163wallet: move fAbortRescan reset into WalletRescanReserver reserve() (Pol Espinasa) Pull request description: Follow-up of https://github.com/bitcoin/bitcoin/pull/35179 For extra context refer to the conversations https://github.com/bitcoin/bitcoin/pull/35179#discussion_r3378136210 and comments bellow it. Long story short: currently `ScanForWalletTransactions()` resets the value of `fAbortRescan` before starting the rescan loop. This can cause a race condition where some function (e.g. `importdescriptors`) starts a rescan and at the same time the user aborts it manually. Could happen that the `abortrescan` call returns True (success) but the rescan continues running as the value is overwritten. This PR fixes this by resetting the value of `fAbortRescan` at the very beginning, when the wallet rescan is reserved, removing the race condition. Also adds a test for it. ACKs for top commit: achow101: ACK2818a171c0w0xlt: ACK2818a171c0nebula-21: ACK2818a171c0pablomartin4btc: ACK2818a17pinheadmz: ACK2818a171c0Tree-SHA512: 5b64b9a16a209dd145ccf7b2d7c3a7205038b3b214b02c3d9f1cbda75a6a1c9a41ad5c42cbeda43af6141793965613c47e44300d758149be9bfdf458e85a5520