0
0
Fork 0
mirror of https://github.com/bitcoin/bitcoin.git synced 2025-02-11 11:16:09 -05:00
bitcoin-bitcoin-core/src/wallet
Sebastian Falbesoner 8c7222bda3 wallet: fix GUI crash on cross-chain legacy wallet restore
Restoring a wallet backup from another chain should obviously result
in a dedicated error message (we have "Wallet files should not be
reused across chains. Restart bitcoind with -walletcrosschain to
override." for that). Unfortunately this is currently not the case
for legacy wallet restores, as in the course of cleaning up the
newly created wallet directory a `filesystem_error` exception is
thrown due to the directory not being empty; the wallet database did
indeed load successfully (otherwise we wouldn't know that the chain doesn't
match) and hence BDB-related files and directories are created in the wallet
directory.

For bitcoind, this leads to a very confusing error message:
```
$ ./src/bitcoin-cli restorewallet test123 ~/.bitcoin/regtest/wallets/regtest_wallet/wallet.dat
error code: -1
error message: filesystem error: in remove: Directory not empty ["/home/thestack/.bitcoin/wallets/test123"]
```

Even worse, the GUI crashes in such a scenario:
```
libc++abi: terminating with uncaught exception of type std::__1::__fs::filesystem::filesystem_error: filesystem error: in remove: Directory not empty ["/home/thestack/.bitcoin/wallets/foobar"]
Abort trap (core dumped)
```

Fix this by simply deleting the whole folder via `fs::remove_all`.
2022-12-23 03:24:36 +01:00
..
rpc Merge bitcoin/bitcoin#21576: rpc, gui: bumpfee signer support 2022-12-20 15:30:17 -05:00
test Merge bitcoin/bitcoin#25729: wallet: Check max transaction weight in CoinSelection 2022-12-06 12:08:58 -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: Check max tx weight in coin selector 2022-12-05 19:32:11 +01:00
coinselection.h wallet: Check max tx weight in coin selector 2022-12-05 19:32:11 +01: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 Fixup clang-tidy named argument comments 2022-12-05 15:51:46 +00: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#21576: rpc, gui: bumpfee signer support 2022-12-20 15:30:17 -05: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 Fixup clang-tidy named argument comments 2022-12-05 15:51:46 +00: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#26298: refactor: Move src/interfaces/*.cpp files to libbitcoin_common.a 2022-12-07 14:54:23 +00: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 Merge bitcoin/bitcoin#26668: wallet: if only have one output type, don't perform "mixed" coin selection 2022-12-14 16:16:03 -05:00
spend.h wallet: if only have one output type, don't perform "mixed" coin selection 2022-12-08 15:56:36 -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 wallet: fix GUI crash on cross-chain legacy wallet restore 2022-12-23 03:24:36 +01: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 Merge bitcoin/bitcoin#26462: wallet: fix crash on loading descriptor wallet containing legacy key type entries 2022-12-05 17:37:48 -05:00
walletdb.h wallet: throw error if legacy entries are present on loading descriptor wallets 2022-11-08 12:29:12 +01:00
wallettool.cpp Fixup clang-tidy named argument comments 2022-12-05 15:51:46 +00: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