fanquake
9f650062fc
Merge bitcoin/bitcoin#26005 : Wallet: Fix error handling (copy_file failure in RestoreWallet, and in general via interfaces)
...
c3e536555aa3a7db773170671da1256a2ace2094 Bugfix: Wallet: Return util::Error rather than non-error nullptr when CreateWallet/LoadWallet/RestoreWallet fail (Luke Dashjr)
335ff98c8a64eda38a2a2334102bd253f108c253 Bugfix: Wallet: Wrap RestoreWallet content in a try block to ensure exceptions become returned errors and incomplete wallet directory is removed (Luke Dashjr)
Pull request description:
Bug 1: `copy_file` can throw exceptions, but `RestoreWallet` is expected to return a nullptr with a populated `errors` parameter. This is fixed by wrapping `copy_file` and `LoadWallet` (for good measure) in a `try` block, and converting any exceptions to the intended return style.
Bug 2: `util::Result` turns what would have been a `false` unique_ptr into a `true` nullptr result, which leads to nullptr dereferences in at least the 3 cases of wallet creation/loading/restoring. This is fixed by keeping the pointer as a plain `std::unique_ptr` until actually returning it (ie, after the nullptr check).
Fixes https://github.com/bitcoin-core/gui/issues/661
ACKs for top commit:
achow101:
ACK c3e536555aa3a7db773170671da1256a2ace2094
Tree-SHA512: 4291b3dbbb147acea2e63a704324c9371bc16ecb4237f8753729b0b0a6e55c9758ad61bfe8bd432fd7b0bae95d8b63a9831e61ac8b8d5c0197b550a2e0f4a105
2022-09-19 16:10:47 +01:00
..
2022-08-16 20:00:19 -04:00
2022-07-20 13:10:12 +01:00
2022-08-29 08:10:35 -04:00
2022-08-13 13:55:38 +01:00
2022-07-20 15:34:36 +02:00
2022-09-13 19:10:41 +01:00
2022-08-20 11:55:17 +02:00
2022-08-29 08:10:35 -04:00
2022-09-09 11:47:27 -04:00
2022-07-29 14:43:11 +01:00
2022-06-29 16:35:02 +01:00
2022-09-09 11:47:27 -04:00
2022-08-22 14:59:58 +01:00
2022-08-31 15:10:26 +02:00
2022-09-16 12:39:39 +02:00
2022-09-16 11:10:15 +01:00
2022-09-17 15:12:48 +02:00
2022-06-11 14:55:18 +01:00
2022-06-20 12:22:05 +01:00
2022-09-17 10:47:05 +02:00
2022-08-20 09:32:53 +02:00
2022-09-14 11:00:14 +01:00
2022-09-19 16:10:47 +01:00
2022-09-14 09:33:34 +01:00
2022-04-26 10:43:33 +01:00
2022-08-31 08:38:24 +01:00
2022-07-30 10:23:58 +02:00
2022-07-30 11:04:09 +02:00
2022-07-30 11:04:09 +02:00
2022-07-30 11:04:09 +02:00
2022-07-30 10:23:58 +02:00
2022-05-20 15:17:00 +02:00
2022-04-27 14:16:35 +02:00
2022-05-21 13:54:33 -05:00
2022-09-09 11:47:27 -04:00
2022-08-19 17:11:06 +02:00
2022-09-14 09:10:04 +01:00
2022-07-20 10:34:46 +01:00
2022-07-20 10:34:46 +01:00
2022-07-20 10:34:46 +01:00
2022-05-17 10:37:10 +01:00
2022-05-17 10:37:10 +01:00
2022-08-24 10:15:32 +02:00
2022-08-31 16:51:32 +01:00
2022-08-31 15:10:26 +02:00
2022-08-23 16:05:00 -04:00
2022-08-31 15:31:34 +03:00
2022-09-09 10:07:39 +02:00
2022-05-12 02:25:55 +10:00
2022-08-19 17:11:06 +02:00
2022-06-21 16:19:10 +02:00
2022-05-21 13:54:33 -05:00
2022-07-27 13:27:57 +02:00
2022-08-03 12:03:28 -04:00
2022-07-19 14:32:53 +02:00
2022-07-19 14:32:53 +02:00
2022-05-10 12:09:33 +10:00
2022-05-10 12:09:33 +10:00
2022-07-27 13:27:57 +02:00
2022-09-14 11:55:10 +01:00
2022-08-19 08:58:56 +01:00
2022-08-30 13:52:45 +02:00
2022-07-20 15:34:36 +02:00
2022-08-30 12:09:04 -04:00
2022-08-29 08:10:35 -04:00
2022-05-18 19:15:03 +02:00
2022-09-02 12:50:12 +01:00
2022-09-12 12:55:36 +02:00
2022-08-11 17:51:18 +02:00
2022-09-16 11:10:15 +01:00
2022-06-02 11:42:12 -04:00
2022-08-04 11:32:26 +02:00
2022-08-04 11:32:25 +02:00
2022-09-01 15:57:56 -04:00
2022-08-30 12:09:04 -04:00
2022-09-16 14:53:53 +01:00
2022-09-13 17:15:17 +01:00
2022-04-26 16:25:38 -04:00
2022-06-23 15:33:01 +02:00
2022-09-13 17:15:17 +01:00
2022-09-13 17:15:17 +01:00
2022-09-15 09:30:26 +01:00
2022-09-15 09:30:26 +01:00
2022-09-13 17:15:17 +01:00
2022-07-20 10:34:46 +01:00
2022-08-30 14:11:21 -04:00
2022-08-29 08:10:35 -04:00
2022-05-18 19:15:03 +02:00
2022-09-16 11:10:15 +01:00
2022-09-01 20:55:22 +10:00
2022-05-17 17:18:58 +01:00
2022-07-20 10:34:46 +01:00
2022-07-27 13:27:57 +02:00
2022-07-20 10:34:46 +01:00
2022-06-14 10:38:51 +02:00
2022-08-16 20:00:19 -04:00
2022-08-18 16:47:15 -03:00
2022-08-23 11:34:10 -04:00
2022-08-23 11:34:10 -04:00
2022-05-16 16:25:47 +02:00
2022-08-20 15:11:28 +02:00
2022-07-26 11:06:10 +02:00
2022-06-27 16:47:48 -04:00
2022-08-10 11:58:17 -04:00
2022-08-10 14:25:43 -04:00
2022-08-04 11:32:25 +02:00
2022-07-20 10:34:46 +01:00
2022-07-13 15:21:12 +02:00
2022-07-20 10:34:46 +01:00
2022-08-16 17:26:28 +02:00
2022-05-17 17:18:58 +01:00
2022-05-12 02:25:55 +10:00
2022-07-26 11:05:04 +02:00
2022-06-14 10:38:51 +02:00
2022-04-26 09:41:45 +01:00
2022-06-29 10:31:53 +02:00
2022-08-12 14:10:43 +02:00
2022-07-13 15:20:49 +02:00
2022-08-20 09:33:01 +02:00
2022-08-05 14:59:15 +02:00
2022-08-05 14:59:15 +02:00
2022-07-20 10:34:46 +01:00
2022-07-22 12:45:07 +02:00
2022-07-19 14:12:33 +02:00
2022-09-09 11:08:02 +01:00
2022-09-09 11:47:27 -04:00
2022-07-28 14:39:45 +08:00
2022-07-28 14:39:45 +08:00
2022-09-15 16:48:50 -04:00
2022-09-16 11:10:15 +01:00
2022-09-09 11:47:27 -04:00
2022-05-21 13:54:33 -05:00
2022-05-09 18:35:44 +02:00
2022-05-05 15:55:44 +02:00
2022-05-12 02:25:55 +10:00
2022-05-21 01:23:23 +10:00