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 refactor: Block unsafe fs::path std::string conversion calls 2021-10-05 11:10:47 -04:00
coincontrol.cpp refactor: Drop CCoinControl::SetNull 2021-04-18 21:10:47 +01:00
coincontrol.h External input fund support cleanups 2021-10-06 06:55:34 +08:00
coinselection.cpp Merge bitcoin/bitcoin#22951: consensus: move amount.h into consensus 2021-10-05 09:43:23 +02:00
coinselection.h Merge bitcoin/bitcoin#22951: consensus: move amount.h into consensus 2021-10-05 09:43:23 +02:00
context.cpp Remove g_rpc_chain global 2020-05-28 02:13:19 -04:00
context.h refactor: remove ::vpwallets and related global variables 2021-08-17 04:05:15 -04:00
crypter.cpp refactor: Replace &foo[0] with foo.data() 2021-05-04 06:55:31 +02:00
crypter.h scripted-diff: Bump copyright headers 2020-12-31 09:45:41 +01:00
db.cpp refactor: get wallet path relative to wallet_dir 2021-10-29 09:36:32 -05:00
db.h refactor: post Optional<> removal cleanups 2021-03-17 14:56:20 +08:00
dump.cpp refactor: Block unsafe fs::path std::string conversion calls 2021-10-05 11:10:47 -04:00
dump.h wallettool: Add createfromdump command 2020-12-16 12:33:06 -05:00
external_signer_scriptpubkeyman.cpp Merge bitcoin/bitcoin#21365: Basic Taproot signing support for descriptor wallets 2021-06-18 09:12:44 +12:00
external_signer_scriptpubkeyman.h refactor: remove m_internal from DescriptorSPKman 2021-06-30 08:37:50 +02:00
feebumper.cpp refactor: Detach wallet transaction methods (followup for move-only) 2021-09-01 02:22:58 -05:00
feebumper.h wallet: Avoid translating RPC errors when creating txs 2020-05-01 07:39:06 -04:00
fees.cpp scripted-diff: Bump copyright headers 2020-12-31 09:45:41 +01:00
fees.h [MOVEONLY] consensus: move amount.h into consensus 2021-09-30 07:41:57 +08:00
init.cpp scripted-diff: disable unimplemented ArgsManager BOOL/INT/STRING flags 2021-10-25 10:44:17 -04:00
interfaces.cpp refactor: Block unsafe fs::path std::string conversion calls 2021-10-05 11:10:47 -04:00
ismine.h doc: Add developer documentation to isminetype 2021-01-19 19:04:45 +08:00
load.cpp refactor: Block unsafe fs::path std::string conversion calls 2021-10-05 11:10:47 -04:00
load.h refactor: remove ::vpwallets and related global variables 2021-08-17 04:05:15 -04:00
receive.cpp [MOVEONLY] consensus: move amount.h into consensus 2021-09-30 07:41:57 +08:00
receive.h [MOVEONLY] consensus: move amount.h into consensus 2021-09-30 07:41:57 +08:00
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 refactor: replace util::Ref by std::any (C++17) 2021-03-29 23:29:42 +02:00
salvage.cpp Remove -rescan startup parameter 2021-09-30 12:06:27 +13:00
salvage.h wallettool: Have RecoverDatabaseFile return errors and warnings 2020-07-26 20:22:45 -04:00
scriptpubkeyman.cpp Merge bitcoin/bitcoin#23093: Add ability to flush keypool and always flush when upgrading non-HD to HD 2021-10-14 18:05:58 +02:00
scriptpubkeyman.h refactor: Remove unused KeyIDHasher 2021-08-22 17:31:58 +02:00
spend.cpp External input fund support cleanups 2021-10-06 06:55:34 +08:00
spend.h Merge bitcoin/bitcoin#22951: consensus: move amount.h into consensus 2021-10-05 09:43:23 +02:00
sqlite.cpp wallet: Use PACKAGE_NAME to mention our software 2021-10-20 21:09:14 +03:00
sqlite.h doc: fix various typos 2021-01-04 12:31:31 +08:00
transaction.cpp MOVEONLY: CWallet transaction code out of wallet.cpp/.h 2021-05-26 06:32:51 -05:00
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 Merge bitcoin/bitcoin#22951: consensus: move amount.h into consensus 2021-10-05 09:43:23 +02:00
wallettool.cpp refactor: const shared_ptrs 2021-10-25 16:12:19 +09:00
wallettool.h refactor: Move all command dependend checks to ExecuteWalletToolFunc 2021-01-21 19:30:34 +01:00
walletutil.cpp refactor: Block unsafe fs::path std::string conversion calls 2021-10-05 11:10:47 -04:00
walletutil.h wallet: Upgrade existing descriptor caches 2021-06-24 13:49:22 -04:00