Thanks to visit codestin.com
Credit goes to github.com

Skip to content
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
9 changes: 9 additions & 0 deletions vote-interface/src/state/vote_state_v4.rs
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,15 @@ impl VoteStateV4 {
// Always initialized
}

/// 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
}
}

#[cfg(test)]
pub(crate) fn get_max_sized_vote_state() -> Self {
use super::{MAX_EPOCH_CREDITS_HISTORY, MAX_LOCKOUT_HISTORY};
Expand Down