Skip to content
Merged
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: 2 additions & 10 deletions vote-interface/src/state/vote_state_v3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -363,21 +363,13 @@ impl VoteStateV3 {
}

pub fn current_epoch(&self) -> Epoch {
if self.epoch_credits.is_empty() {
0
} else {
self.epoch_credits.last().unwrap().0
}
self.epoch_credits.last().map_or(0, |v| v.0)
}

/// Number of "credits" owed to this account from the mining pool. Submit this
/// VoteStateV3 to the Rewards program to trade credits for lamports.
pub fn credits(&self) -> u64 {
if self.epoch_credits.is_empty() {
0
} else {
self.epoch_credits.last().unwrap().1
}
self.epoch_credits.last().map_or(0, |v| v.1)
}

/// Number of "credits" owed to this account from the mining pool on a per-epoch basis,
Expand Down
6 changes: 1 addition & 5 deletions vote-interface/src/state/vote_state_v4.rs
Original file line number Diff line number Diff line change
Expand Up @@ -211,11 +211,7 @@ impl VoteStateV4 {

/// Number of credits owed to this account.
pub fn credits(&self) -> u64 {
if self.epoch_credits.is_empty() {
0
} else {
self.epoch_credits.last().unwrap().1
}
self.epoch_credits.last().map_or(0, |v| v.1)
}

#[cfg(test)]
Expand Down