0
0
Fork 0
mirror of https://github.com/bitcoin/bitcoin.git synced 2025-03-10 15:46:48 -04:00
bitcoin-core/src/wallet
fanquake e334f7a545
Merge bitcoin/bitcoin#26594: wallet: Avoid a segfault in migratewallet failure cleanup
5e65a216d1 wallet: Explicitly say migratewallet on encrypted wallets is unsupported (Andrew Chow)
88afc73ae0 tests: Test for migrating encrypted wallets (Andrew Chow)
86ef7b3c7b wallet: Avoid null pointer deref when cleaning up migratewallet (Andrew Chow)

Pull request description:

  When `migratewallet` fails, we do an automatic cleanup in order to reset everything so that the user does not experience any interruptions. However, this apparently has a segfault in it, caused by the the pointers to the watchonly and solvables wallets being nullptr. If those wallets are not created (either not needed, or failed early on), we will accidentally attempt to dereference these nullptrs, which causes a segfault.

  This failure can be easily reached by trying to migrate an encrypted wallet. Currently, we can't migrate encrypted wallets because of how we unload wallets before migrating, and therefore forget the encryption key if the wallet was unlocked. So any encrypted wallets will fail, entering the cleanup, and because watchonly and solvables wallets don't exist yet, the segfault is reached.

  This PR fixes this by not putting those nullptrs in a place that we will end up dereferencing them later. It also adds a test that uses the encrypted wallet issue.

ACKs for top commit:
  S3RK:
    reACK 5e65a216d1
  stickies-v:
    ACK [5e65a21](5e65a216d1)
  furszy:
    diff ACK 5e65a21

Tree-SHA512: f75643797220d4232ad3ab8cb4b46d0f3667f00486e910ca748c9b6d174d446968f1ec4dd7f907da1be9566088849da7edcd8cd8f12de671c3241b513deb8e80
2022-12-01 10:17:09 +00:00
..
rpc Merge bitcoin/bitcoin#26594: wallet: Avoid a segfault in migratewallet failure cleanup 2022-12-01 10:17:09 +00:00
test Merge bitcoin/bitcoin#25942: test: add ismine test for descriptor ScriptPubKeyMan 2022-11-30 11:28:32 -05:00
bdb.cpp Merge bitcoin/bitcoin#25499: Use steady clock for all millis bench logging 2022-09-16 11:10:15 +01:00
bdb.h scripted-diff: replace non-standard fixed width integer types (u_int... -> uint`...) 2022-05-12 15:44:24 +02:00
coincontrol.cpp Add src/wallet/* code to wallet:: namespace 2022-01-06 22:14:16 -05:00
coincontrol.h wallet: skip available coins fetch if "other inputs" are disallowed 2022-10-26 15:47:51 -03:00
coinselection.cpp wallet: encapsulate pre-selected-inputs lookup into its own function 2022-10-26 15:52:35 -03:00
coinselection.h wallet: encapsulate pre-selected-inputs lookup into its own function 2022-10-26 15:52:35 -03:00
context.cpp refactor: use C++11 default initializers 2022-05-17 17:18:58 +01:00
context.h Add src/wallet/* code to wallet:: namespace 2022-01-06 22:14:16 -05:00
crypter.cpp Add src/wallet/* code to wallet:: namespace 2022-01-06 22:14:16 -05:00
crypter.h Add src/wallet/* code to wallet:: namespace 2022-01-06 22:14:16 -05:00
db.cpp Replace use of ArgsManager with DatabaseOptions 2022-03-16 08:26:28 +01:00
db.h Replace use of ArgsManager with DatabaseOptions 2022-03-16 08:26:28 +01:00
dump.cpp Use HashWriter where possible 2022-07-20 15:34:36 +02:00
dump.h Replace use of ArgsManager with DatabaseOptions 2022-03-16 08:26:28 +01:00
external_signer_scriptpubkeyman.cpp GetExternalSigner(): fail if multiple signers are found 2022-06-09 20:34:46 +02:00
external_signer_scriptpubkeyman.h Add src/wallet/* code to wallet:: namespace 2022-01-06 22:14:16 -05:00
feebumper.cpp Merge bitcoin/bitcoin#25775: docs: remove non-signaling mentions of BIP125 2022-08-22 10:35:26 +01:00
feebumper.h bumpfee: be able to bump fee of a tx with external inputs 2022-08-19 11:27:01 -04:00
fees.cpp Remove ::dustRelayFee 2022-08-02 15:26:49 +02:00
fees.h Add src/wallet/* code to wallet:: namespace 2022-01-06 22:14:16 -05:00
init.cpp scripted-diff: Avoid incompatibility with CMake AUTOUIC feature 2022-06-14 10:38:51 +02:00
interfaces.cpp Merge bitcoin/bitcoin#26005: Wallet: Fix error handling (copy_file failure in RestoreWallet, and in general via interfaces) 2022-09-19 16:10:47 +01:00
ismine.h Add src/wallet/* code to wallet:: namespace 2022-01-06 22:14:16 -05:00
load.cpp wallet: trigger MaybeResendWalletTxs() every minute 2022-08-25 14:29:25 +01:00
load.h Add src/wallet/* code to wallet:: namespace 2022-01-06 22:14:16 -05:00
receive.cpp Merge bitcoin/bitcoin#25707: refactor: Make const references to avoid unnecessarily copying objects and enable two clang-tidy checks 2022-08-19 17:11:06 +02:00
receive.h Merge bitcoin/bitcoin#25504: RPC: allow to track coins by parent descriptors 2022-08-16 13:08:05 -04:00
salvage.cpp Replace use of ArgsManager with DatabaseOptions 2022-03-16 08:26:28 +01:00
salvage.h Replace use of ArgsManager with DatabaseOptions 2022-03-16 08:26:28 +01:00
scriptpubkeyman.cpp psbt: Include output pubkey in additional pubkeys to sign 2022-10-28 20:03:22 -04:00
scriptpubkeyman.h wallet: add method for retrieving the end range for a ScriptPubKeyMan 2022-10-25 15:57:38 +02:00
spend.cpp scripted-diff: wallet: rename AvailableCoinsParams members to snake_case 2022-10-29 08:51:34 -03:00
spend.h scripted-diff: wallet: rename AvailableCoinsParams members to snake_case 2022-10-29 08:51:34 -03:00
sqlite.cpp scripted-diff: Convert global Mutexes to GlobalMutexes 2022-05-21 01:23:23 +10:00
sqlite.h Replace use of ArgsManager with DatabaseOptions 2022-03-16 08:26:28 +01:00
transaction.cpp Add src/wallet/* code to wallet:: namespace 2022-01-06 22:14:16 -05:00
transaction.h wallet: Deduplicate Resend and ReacceptWalletTransactions 2022-08-29 12:38:06 -04:00
wallet.cpp Merge bitcoin/bitcoin#26594: wallet: Avoid a segfault in migratewallet failure cleanup 2022-12-01 10:17:09 +00:00
wallet.h Merge bitcoin/bitcoin#26302: refactor: Use type-safe time point for CWallet::m_next_resend 2022-10-24 10:11:13 +08:00
walletdb.cpp wallet: bugfix, invalid crypted key "checksum_valid" set 2022-11-18 11:38:56 -03:00
walletdb.h wallet: bugfix, load wallet with an unknown descriptor cause fatal error 2022-09-09 15:35:04 -03:00
wallettool.cpp Merge bitcoin/bitcoin#25784: Wallet: Document expectations for AddWalletFlags (now InitWalletFlags) correctly 2022-08-19 12:12:27 -04:00
wallettool.h Add src/wallet/* code to wallet:: namespace 2022-01-06 22:14:16 -05:00
walletutil.cpp Use ArgsManager::GetPathArg() for "-walletdir" option 2022-02-09 19:31:23 +02:00
walletutil.h Implement LegacyScriptPubKeyMan::MigrateToDescriptor 2022-08-25 16:25:53 -04:00