Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarify SlotMeta::is_full #3008

Merged
merged 1 commit into from
Feb 28, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/blocktree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down