Ava Chow
547c64814d
Merge bitcoin/bitcoin#32987 : init: [gui] Avoid UB/crash in InitAndLoadChainstate
...
fac90e5261b811739ada56e06ea793a12f9c2c3d test: Check that the GUI interactive reindex works (MarcoFalke)
faaaddaaf8e5a63f19c4fc66aa79134987775f96 init: [gui] Avoid UB/crash in InitAndLoadChainstate (MarcoFalke)
Pull request description:
`InitAndLoadChainstate` is problematic, when called twice in the GUI. This can happen when it returns a failure and the user selects an interactive reindex.
There are several bugs that have been introduced since the last time this was working correctly:
* The first one is a crash (assertion failure), which happens due to a cached tip block in the notifiications from the previous run. See https://github.com/bitcoin/bitcoin/pull/31346#discussion_r2207914726
* The second one is UB (use-after-free), which happens because the block index db in the blockmanager is not reset. See https://github.com/bitcoin/bitcoin/pull/30965#discussion_r2207822121
Fix both bugs by resetting any dirty state in `InitAndLoadChainstate`.
Also, add a test, because I don't really want to keep testing this manually every time. (A failing test run can be seen in https://github.com/bitcoin/bitcoin/pull/32979/checks )
ACKs for top commit:
achow101:
ACK fac90e5261b811739ada56e06ea793a12f9c2c3d
TheCharlatan:
ACK fac90e5261b811739ada56e06ea793a12f9c2c3d
mzumsande:
Tested ACK fac90e5261b811739ada56e06ea793a12f9c2c3d
Tree-SHA512: 9f744d36e7cdd3f5871764386ec5a5cca1ae144f1bacc26c07e60313c2bdacdc5fca351aa185cb51359540eea4534dda17e4fb6073ad90f91ba0a6936faeead8
2025-07-30 13:55:01 -07:00
..
2025-07-29 09:07:10 -04:00
2025-07-30 13:55:01 -07:00
2025-05-08 16:49:58 +01:00
2025-06-03 19:56:55 +02:00
2025-06-03 19:56:55 +02:00
2025-07-11 15:18:22 +02:00
2025-07-25 09:50:50 +02:00
2025-07-11 13:47:19 -04:00
2025-06-19 16:29:55 +02:00
2025-07-25 09:50:50 +02:00
2025-05-30 16:51:49 +01:00
2025-02-21 10:43:01 +01:00
2025-05-13 18:07:47 +01:00
2025-07-25 09:50:50 +02:00
2025-07-25 09:50:50 +02:00
2025-07-11 13:47:19 -04:00
2025-07-30 12:56:41 +01:00
2025-07-30 14:30:22 -04:00
2025-07-25 22:33:50 -07:00
2025-07-22 09:35:01 +01:00
2025-05-19 16:40:33 +01:00
2025-07-30 09:24:11 -03:00
2025-07-23 13:29:07 -07:00
2025-07-30 14:20:03 -04:00
2025-07-29 11:15:59 -07:00
2025-06-13 19:19:44 +03:00
2025-06-03 15:13:54 +02:00
2025-07-10 11:24:40 +02:00
2024-07-30 14:06:58 -04:00
2025-03-23 21:58:39 +01:00
2024-09-20 12:55:22 -04:00
2024-11-11 12:47:53 -03:00
2024-11-11 12:47:53 -03:00
2025-01-09 10:11:46 -05:00
2025-04-07 10:45:13 -04:00
2025-07-25 09:50:50 +02:00
2025-05-19 16:40:33 +01:00
2025-06-03 15:13:54 +02:00
2025-03-12 19:46:54 +01:00
2025-06-03 15:13:57 +02:00
2025-06-03 15:13:57 +02:00
2025-06-03 19:56:55 +02:00
2025-03-12 19:46:54 +01:00
2025-05-24 13:49:32 +02:00
2025-06-10 15:14:24 +02:00
2025-05-15 19:48:38 +02:00
2025-06-10 15:14:24 +02:00
2025-06-10 15:14:24 +02:00
2025-05-17 09:36:25 +02:00
2025-06-10 15:14:24 +02:00
2025-01-15 12:15:40 +01:00
2025-06-10 15:14:24 +02:00
2025-05-09 15:07:04 +02:00
2025-05-12 14:49:17 -04:00
2025-06-10 15:14:24 +02:00
2025-01-16 21:06:21 +00:00
2025-06-10 10:07:56 -04:00
2025-06-10 10:07:56 -04:00
2024-05-16 10:16:08 -05:00
2025-06-12 14:40:59 -04:00
2025-07-25 09:50:50 +02:00
2025-06-03 15:13:57 +02:00
2024-11-14 13:41:02 -05:00
2025-03-06 15:39:58 -06:00
2025-05-19 22:06:48 +00:00
2025-05-20 09:30:41 +01:00
2025-05-29 11:18:36 +01:00
2025-07-14 09:41:17 -04:00
2025-07-22 09:35:01 +01:00
2024-12-04 14:09:05 -05:00
2025-06-03 15:13:57 +02:00
2025-03-12 19:46:54 +01:00
2024-11-26 20:47:08 -05:00
2025-04-22 13:16:54 +01:00
2025-01-22 17:31:22 -05:00
2025-05-19 16:40:33 +01:00
2025-07-25 09:50:50 +02:00
2025-07-16 14:33:07 -07:00
2025-04-30 14:51:21 +02:00
2025-04-30 14:51:21 +02:00
2025-02-21 10:41:27 +01:00
2025-01-21 00:38:03 +10:00
2025-07-25 09:50:50 +02:00
2024-08-13 07:44:31 +02:00
2025-06-16 15:33:19 +02:00
2024-07-24 09:39:35 +02:00
2025-03-12 19:46:54 +01:00
2025-03-12 19:46:54 +01:00
2025-03-04 14:23:18 -05:00
2025-05-19 16:40:33 +01:00
2025-07-03 06:26:23 -04:00
2025-07-25 09:50:50 +02:00
2024-11-04 17:08:21 +01:00
2025-04-22 13:16:54 +01:00
2024-06-12 16:19:50 -03:00
2020-04-16 13:33:09 -04:00
2025-07-30 13:55:01 -07:00
2025-01-16 21:06:21 +00:00
2025-06-03 15:13:57 +02:00
2025-03-12 19:46:54 +01:00
2025-03-12 19:46:54 +01:00
2025-07-09 09:13:00 -04:00
2025-07-09 09:13:00 -04:00
2024-11-04 14:19:40 -05:00
2025-07-17 12:43:04 -04:00
2024-11-04 18:46:40 +01:00
2024-07-08 11:12:01 +02:00
2024-05-16 10:16:08 -05:00
2025-02-21 10:41:27 +01:00
2025-07-30 14:20:03 -04:00
2025-07-14 16:13:10 -04:00
2024-05-20 16:48:19 +00:00
2024-07-08 11:12:01 +02:00
2025-07-22 14:29:36 +02:00
2025-07-22 14:29:37 +02:00
2025-06-03 08:09:21 +01:00
2025-03-12 19:46:54 +01:00
2025-06-30 13:28:17 -04:00
2025-06-03 19:56:55 +02:00
2025-07-25 09:50:50 +02:00
2025-07-25 09:50:50 +02:00
2025-06-18 18:11:28 -03:00
2025-06-18 18:11:28 -03:00
2025-04-22 17:11:24 +10:00
2025-06-03 15:13:57 +02:00
2025-07-25 16:23:37 -07:00
2025-07-08 20:00:51 +01:00
2025-07-08 20:00:51 +01:00
2025-05-14 14:00:43 -07:00
2025-05-14 14:00:43 -07:00
2025-03-12 19:46:54 +01:00
2025-03-12 19:46:54 +01:00
2025-07-25 09:50:50 +02:00
2025-07-16 13:19:18 -07:00
2025-05-08 16:49:58 +01:00
2025-07-06 11:20:18 +08:00
2025-06-16 18:09:14 +00:00
2025-05-10 03:31:30 +00:00
2025-05-14 15:41:20 +02:00
2025-03-12 19:46:54 +01:00
2025-03-12 19:46:54 +01:00
2025-07-16 14:33:07 -07:00
2025-07-16 14:33:07 -07:00
2025-02-21 10:43:01 +01:00
2025-07-07 15:51:37 +01:00
2025-05-08 20:13:46 +00:00
2025-01-15 12:16:08 +01:00
2025-05-13 12:09:40 +02:00
2025-05-13 12:09:40 +02:00
2025-04-07 15:59:41 +02:00
2025-01-15 15:44:55 +01:00
2025-07-14 10:28:54 -04:00
2025-07-14 10:28:54 -04:00
2025-07-30 14:20:03 -04:00
2025-07-30 14:20:03 -04:00
2025-07-23 15:01:18 +01:00
2025-07-23 15:01:18 +01:00
2025-04-09 15:59:59 +01:00
2025-04-09 15:59:59 +01:00
2025-07-29 10:01:02 +01:00
2025-07-18 14:02:59 +02:00
2025-06-16 18:09:14 +00:00
2025-07-07 18:14:52 +01:00
2025-01-21 00:38:03 +10:00
2025-04-30 14:51:21 +02:00
2025-04-30 14:51:21 +02:00
2024-07-08 11:12:01 +02:00