3 Commits

Author SHA1 Message Date
marcofleon
20ae9b98ea Extend functional test for setBlockIndexCandidates UB
Fix the from-disk subtest to use a separate node so it builds on a
clean genesis block, rather than the leftover chain from the
in-memory subtest.

Change from a two-way to a three-way block race. The UB in the old
LoadChainTip (mutating nSequenceId, a sort key, while the block is
in setBlockIndexCandidates) corrupts the internal tree structure,
resulting in a failed erase that leaves stale blocks in the set
alongside the tip. With only two competing blocks, this is caught
by libstdc++ but not by libc++. A three-way split triggers the bug
on both implementations.

To trigger CheckBlockIndex (where the crashing assertion is), replace
the restart loop with sending a new block after a single restart.
2026-03-04 20:13:53 +00:00
Sergi Delgado Segura
09c95f21e7 test: Adds block tiebreak over restarts tests
Adds tests to make sure we are consistent on activating the same chain over
a node restart if two or more candidates have the same work when the node is shutdown
2025-07-28 10:15:17 -04:00
Pieter Wuille
5370bed21e test: add functional test for complex reorgs 2025-07-28 10:11:34 -04:00