Files
bitcoin/src/wallet/test
Ava Chow 61c754ae99 Merge bitcoin/bitcoin#35512: wallet: move fAbortRescan reset into WalletRescanReserver reserve function
2818a171c0 test: add abortscan unit test (Pol Espinasa)
bc30e95163 wallet: 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:
    ACK 2818a171c0
  w0xlt:
    ACK 2818a171c0
  nebula-21:
    ACK 2818a171c0
  pablomartin4btc:
    ACK 2818a17
  pinheadmz:
    ACK 2818a171c0

Tree-SHA512: 5b64b9a16a209dd145ccf7b2d7c3a7205038b3b214b02c3d9f1cbda75a6a1c9a41ad5c42cbeda43af6141793965613c47e44300d758149be9bfdf458e85a5520
2026-06-19 12:44:53 -07:00
..