Skip to content

Commit d0bf935

Browse files
authored
Merge pull request #161 from input-output-hk/expose_voting_registration
Expose voting registration
2 parents ffe94ed + dcebe0a commit d0bf935

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

snapshot-lib/src/registration.rs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ pub type MainnetRewardAddress = String;
66
pub type MainnetStakeAddress = String;
77

88
/// The voting registration/delegation format as introduced in CIP-36,
9-
/// which is a generalizatin of CIP-15, allowing to distribute
9+
/// which is a generalization of CIP-15, allowing to distribute
1010
/// voting power among multiple keys in a single transaction and
1111
/// to tag the purpose of the vote.
1212
#[derive(Deserialize, Clone, Debug, PartialEq)]
@@ -22,6 +22,16 @@ pub struct VotingRegistration {
2222
pub voting_purpose: u64,
2323
}
2424

25+
impl VotingRegistration {
26+
pub fn is_legacy(&self) -> bool {
27+
matches!(self.delegations, Delegations::Legacy(_))
28+
}
29+
30+
pub fn is_new(&self) -> bool {
31+
!self.is_legacy()
32+
}
33+
}
34+
2535
/// To allow backward compatibility and avoid requiring existing users to
2636
/// re-register we still consider valid old CIP-15 registrations, with the
2737
/// simple correspondence between the two described in CIP-36.

0 commit comments

Comments
 (0)