Skip to content
Closed
Show file tree
Hide file tree
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
12 changes: 6 additions & 6 deletions src/perms/builders.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,28 +135,28 @@ impl Builders {

/// Get the builder permissioned at a specific timestamp.
pub fn builder_at_timestamp(&self, timestamp: u64) -> &Builder {
self.builder_at(self.index(timestamp) as usize)
self.builder_at(self.index(timestamp))
}

/// Get the index of the builder that is allowed to sign a block for a
/// particular timestamp.
pub fn index(&self, timestamp: u64) -> u64 {
pub fn index(&self, timestamp: u64) -> usize {
self.config
.calc()
.time_to_slot(timestamp)
.slot_containing(timestamp)
.expect("host chain has started")
% self.builders.len() as u64
% self.builders.len()
}

/// Get the index of the builder that is allowed to sign a block at the
/// current timestamp.
pub fn index_now(&self) -> u64 {
pub fn index_now(&self) -> usize {
self.index(now())
}

/// Get the builder that is allowed to sign a block at the current timestamp.
pub fn current_builder(&self) -> &Builder {
self.builder_at(self.index_now() as usize)
self.builder_at(self.index_now())
}

/// Check the query bounds for the current timestamp.
Expand Down
Loading