11pub use fraction:: Fraction ;
22use jormungandr_lib:: { crypto:: account:: Identifier , interfaces:: Value } ;
3- use proptest :: prelude :: Arbitrary ;
3+ use registration :: MainnetStakeAddress ;
44use registration:: { Delegations , MainnetRewardAddress , VotingRegistration } ;
55use serde:: { Deserialize , Serialize } ;
66use std:: { borrow:: Borrow , collections:: BTreeMap , iter:: Iterator , num:: NonZeroU64 } ;
@@ -36,6 +36,7 @@ pub enum Error {
3636/// Contribution to a voting key for some registration
3737#[ derive( Clone , Debug , PartialEq , Eq , Serialize , Deserialize ) ]
3838pub struct KeyContribution {
39+ pub stake_public_key : MainnetStakeAddress ,
3940 pub reward_address : MainnetRewardAddress ,
4041 pub value : u64 ,
4142}
@@ -79,12 +80,14 @@ impl Snapshot {
7980 reward_address,
8081 delegations,
8182 voting_power,
83+ stake_public_key,
8284 ..
8385 } = reg;
8486
8587 match delegations {
8688 Delegations :: Legacy ( vk) => {
8789 acc. entry ( vk) . or_default ( ) . push ( KeyContribution {
90+ stake_public_key,
8891 reward_address,
8992 value : voting_power. into ( ) ,
9093 } ) ;
@@ -103,6 +106,7 @@ impl Snapshot {
103106 } )
104107 . map ( |( vk, value) | {
105108 acc. entry ( vk) . or_default ( ) . push ( KeyContribution {
109+ stake_public_key : stake_public_key. clone ( ) ,
106110 reward_address : reward_address. clone ( ) ,
107111 value : value. get ( ) ,
108112 } ) ;
@@ -111,6 +115,7 @@ impl Snapshot {
111115 . sum :: < u64 > ( )
112116 } ) ;
113117 acc. entry ( last. 0 ) . or_default ( ) . push ( KeyContribution {
118+ stake_public_key,
114119 reward_address,
115120 value : voting_power - others_total_vp,
116121 } ) ;
0 commit comments