mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
fix(exex): do not finalize WAL with a block higher than finalized header (#11420)
This commit is contained in:
@ -350,14 +350,17 @@ where
|
||||
.collect::<Result<Vec<_>, _>>()?;
|
||||
if exex_finished_heights.iter().all(|(_, _, is_canonical)| *is_canonical) {
|
||||
// If there is a finalized header and all ExExs are on the canonical chain, finalize
|
||||
// the WAL with the lowest finished height among all ExExes
|
||||
// the WAL with either the lowest finished height among all ExExes, or finalized header
|
||||
// – whichever is lower.
|
||||
let lowest_finished_height = exex_finished_heights
|
||||
.iter()
|
||||
.copied()
|
||||
.filter_map(|(_, num_hash, _)| num_hash)
|
||||
.min_by_key(|num_hash| num_hash.number);
|
||||
self.wal
|
||||
.finalize(lowest_finished_height.expect("ExExManager has at least one ExEx"))?;
|
||||
.chain([(finalized_header.num_hash())])
|
||||
.min_by_key(|num_hash| num_hash.number)
|
||||
.unwrap();
|
||||
|
||||
self.wal.finalize(lowest_finished_height)?;
|
||||
} else {
|
||||
let unfinalized_exexes = exex_finished_heights
|
||||
.into_iter()
|
||||
|
||||
Reference in New Issue
Block a user