Skip to content
This repository was archived by the owner on Sep 24, 2025. It is now read-only.

Commit f4d00fb

Browse files
committed
feat(vote): expose bank id and bank hash for notar and notar fallback votes.
1 parent e4f33e5 commit f4d00fb

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

program/src/vote.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,24 @@ impl Vote {
145145
}
146146
}
147147

148+
/// The block id associated with the block which was voted for
149+
pub fn block_id(&self) -> Option<&Hash> {
150+
match self {
151+
Self::Notarize(vote) => Some(vote.block_id()),
152+
Self::NotarizeFallback(vote) => Some(vote.block_id()),
153+
Self::Finalize(_) | Self::Skip(_) | Self::SkipFallback(_) => None,
154+
}
155+
}
156+
157+
/// The replayed bank hash associated with the block which was voted for
158+
pub fn replayed_bank_hash(&self) -> Option<&Hash> {
159+
match self {
160+
Self::Notarize(vote) => Some(vote.replayed_bank_hash()),
161+
Self::NotarizeFallback(vote) => Some(vote.replayed_bank_hash()),
162+
Self::Finalize(_) | Self::Skip(_) | Self::SkipFallback(_) => None,
163+
}
164+
}
165+
148166
/// Whether the vote is a notarization vote
149167
pub fn is_notarization(&self) -> bool {
150168
matches!(self, Self::Notarize(_))

0 commit comments

Comments
 (0)