Skip to content

Commit 4810d64

Browse files
committed
extend KeyContribution struct
1 parent e21949a commit 4810d64

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

snapshot-lib/src/lib.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
pub use fraction::Fraction;
22
use jormungandr_lib::{crypto::account::Identifier, interfaces::Value};
33
use proptest::prelude::Arbitrary;
4+
use registration::MainnetStakeAddress;
45
use registration::{Delegations, MainnetRewardAddress, VotingRegistration};
56
use serde::{Deserialize, Serialize};
67
use std::{borrow::Borrow, collections::BTreeMap, iter::Iterator, num::NonZeroU64};
@@ -36,6 +37,7 @@ pub enum Error {
3637
/// Contribution to a voting key for some registration
3738
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
3839
pub struct KeyContribution {
40+
pub stake_public_key: MainnetStakeAddress,
3941
pub reward_address: MainnetRewardAddress,
4042
pub value: u64,
4143
}
@@ -79,12 +81,14 @@ impl Snapshot {
7981
reward_address,
8082
delegations,
8183
voting_power,
84+
stake_public_key,
8285
..
8386
} = reg;
8487

8588
match delegations {
8689
Delegations::Legacy(vk) => {
8790
acc.entry(vk).or_default().push(KeyContribution {
91+
stake_public_key,
8892
reward_address,
8993
value: voting_power.into(),
9094
});
@@ -103,6 +107,7 @@ impl Snapshot {
103107
})
104108
.map(|(vk, value)| {
105109
acc.entry(vk).or_default().push(KeyContribution {
110+
stake_public_key: stake_public_key.clone(),
106111
reward_address: reward_address.clone(),
107112
value: value.get(),
108113
});
@@ -111,6 +116,7 @@ impl Snapshot {
111116
.sum::<u64>()
112117
});
113118
acc.entry(last.0).or_default().push(KeyContribution {
119+
stake_public_key,
114120
reward_address,
115121
value: voting_power - others_total_vp,
116122
});

0 commit comments

Comments
 (0)