Clarify is_full

This commit is contained in:
Greg Fitzgerald 2019-02-28 09:44:17 -07:00
parent 4704aa1f80
commit 8d004ee947
1 changed files with 9 additions and 1 deletions

View File

@ -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 {