mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-19 14:53:43 +01:00
fac90e5261test: Check that the GUI interactive reindex works (MarcoFalke)faaaddaaf8init: [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: ACKfac90e5261TheCharlatan: ACKfac90e5261mzumsande: Tested ACKfac90e5261Tree-SHA512: 9f744d36e7cdd3f5871764386ec5a5cca1ae144f1bacc26c07e60313c2bdacdc5fca351aa185cb51359540eea4534dda17e4fb6073ad90f91ba0a6936faeead8