From 8d004ee94707c052f855b221aa14b53df3745203 Mon Sep 17 00:00:00 2001 From: Greg Fitzgerald Date: Thu, 28 Feb 2019 09:44:17 -0700 Subject: [PATCH] Clarify is_full --- src/blocktree.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/blocktree.rs b/src/blocktree.rs index 52888578dd..920e926e42 100644 --- a/src/blocktree.rs +++ b/src/blocktree.rs @@ -142,7 +142,15 @@ pub struct SlotMeta { impl SlotMeta { pub fn is_full(&self) -> bool { - self.consumed > self.last_index + // last_index is std::u64::MAX when it has no information about how + // many blobs will fill this slot. + // Note: A full slot with zero blobs is not possible. + if self.last_index == std::u64::MAX { + return false; + } + assert!(self.consumed <= self.last_index + 1); + + self.consumed == self.last_index + 1 } fn new(slot_height: u64, parent_slot: u64) -> Self {