bitcoin/src/wallet
MarcoFalke 5adc5c0280
Merge bitcoin/bitcoin#23403: test: Fix segfault in the psbt_wallet_tests/psbt_updater_test
68018e4c3e test: Avoid excessive locking of `cs_wallet` (Hennadii Stepanov)
7986faf2e0 test: Fix segfault in the psbt_wallet_tests/psbt_updater_test (Hennadii Stepanov)

Pull request description:

  The dcd6eeb64a commit (bitcoin/bitcoin#23288) introduced an intermittent failure in the `psbt_wallet_tests/psbt_updater_test` unit test. See bitcoin/bitcoin#23368.

  The test failure can be easily made reproducible with the following patch:
  ```diff
  --- a/src/scheduler.cpp
  +++ b/src/scheduler.cpp
  @@ -57,6 +57,8 @@ void CScheduler::serviceQueue()
               Function f = taskQueue.begin()->second;
               taskQueue.erase(taskQueue.begin());

  +            UninterruptibleSleep(100ms);
  +
               {
                   // Unlock before calling f, so it can reschedule itself or another task
                   // without deadlocking:
  ```

  This PR implements an idea which was mentioned in the [comment](https://github.com/bitcoin/bitcoin/issues/23368#issuecomment-953796339):
  > Yes, as I said before this looks like a race where the wallet is deleted before stopping the scheduler: [#23368 (comment)](https://github.com/bitcoin/bitcoin/issues/23368#issuecomment-952808824)
  >
  > IIRC, the order should be:
  >
  >    * stop scheduler
  >
  >    * delete wallet
  >
  >    * delete scheduler

  The second commit introduces a refactoring with no behavior change.

  Fixes bitcoin/bitcoin#23368.

ACKs for top commit:
  mjdietzx:
    Code review ACK 68018e4c3e

Tree-SHA512: d9103f6252aab807453628159dec243bc543a2595eecaa04ec761dca3c2370085592c55d6f50967d69a4ac6e8b5827eec30dd9b025132c99b0bb9aa5911ad915
2021-11-01 14:24:22 +01:00
..
test test: Avoid excessive locking of `cs_wallet` 2021-10-31 13:48:00 +02:00
bdb.cpp wallet: Use PACKAGE_NAME to mention our software 2021-10-20 21:09:14 +03:00
bdb.h
coincontrol.cpp
coincontrol.h
coinselection.cpp
coinselection.h
context.cpp
context.h
crypter.cpp
crypter.h
db.cpp refactor: get wallet path relative to wallet_dir 2021-10-29 09:36:32 -05:00
db.h
dump.cpp
dump.h
external_signer_scriptpubkeyman.cpp
external_signer_scriptpubkeyman.h
feebumper.cpp
feebumper.h
fees.cpp
fees.h
init.cpp scripted-diff: disable unimplemented ArgsManager BOOL/INT/STRING flags 2021-10-25 10:44:17 -04:00
interfaces.cpp
ismine.h
load.cpp
load.h
receive.cpp
receive.h
rpcdump.cpp refactor: use CWallet const shared pointers when possible 2021-10-25 16:12:21 +09:00
rpcwallet.cpp refactor: use CWallet const shared pointers when possible 2021-10-25 16:12:21 +09:00
rpcwallet.h
salvage.cpp
salvage.h
scriptpubkeyman.cpp
scriptpubkeyman.h
spend.cpp
spend.h
sqlite.cpp wallet: Use PACKAGE_NAME to mention our software 2021-10-20 21:09:14 +03:00
sqlite.h
transaction.cpp
transaction.h doc: Fix CWalletTx::Confirmation doc 2021-10-21 22:13:35 +02:00
wallet.cpp Merge bitcoin/bitcoin#22787: refactor: actual immutable pointing 2021-10-29 10:52:37 +02:00
wallet.h doc: Fix CWalletTx::Confirmation doc 2021-10-21 22:13:35 +02:00
walletdb.cpp walletdb: Use SQLiteDatabase for mock wallet databases 2021-10-22 17:49:43 -04:00
walletdb.h
wallettool.cpp refactor: const shared_ptrs 2021-10-25 16:12:19 +09:00
wallettool.h
walletutil.cpp
walletutil.h