Skip to content

Commit eb2d394

Browse files
committed
sim-rs: fix error when receiving EBs before RBs
1 parent c0aba5b commit eb2d394

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

sim-rs/sim-core/src/sim/linear_leios.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,7 @@ struct NodePraosState {
241241
block_ids_by_slot: BTreeMap<u64, BlockId>,
242242
}
243243

244+
#[derive(Debug)]
244245
enum EndorserBlockView {
245246
Pending,
246247
Requested,
@@ -753,7 +754,14 @@ impl LinearLeiosNode {
753754
self.queued.send_to(from, Message::RequestRB(header.id));
754755
}
755756

757+
// Get ready to fetch the announced EB (if we don't have it already)
756758
let eb_id = header.eb_announcement;
759+
if matches!(
760+
self.leios.ebs.get(&eb_id),
761+
Some(EndorserBlockView::Received { .. })
762+
) {
763+
return;
764+
}
757765

758766
let eb_peer_announcements = self.leios.eb_peer_announcements.entry(eb_id).or_default();
759767
if has_eb {

0 commit comments

Comments
 (0)