Skip to content

Commit c0cf9f4

Browse files
committed
rebase
1 parent ddf7d44 commit c0cf9f4

File tree

2 files changed

+8
-10
lines changed

2 files changed

+8
-10
lines changed

catalyst-toolbox/src/rewards/voters.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
use crate::snapshot::{registration::MainnetRewardAddress, SnapshotInfo};
2-
use jormungandr_lib::crypto::{account::Identifier, hash::Hash};
31
use chain_addr::{Discrimination, Kind};
42
use chain_impl_mockchain::transaction::UnspecifiedAccountIdentifier;
5-
use jormungandr_lib::{crypto::account::Identifier, interfaces::Address};
3+
use jormungandr_lib::{
4+
crypto::{account::Identifier, hash::Hash},
5+
interfaces::Address,
6+
};
67
use rust_decimal::Decimal;
78
use snapshot_lib::{registration::MainnetRewardAddress, SnapshotInfo};
89
use std::collections::{BTreeMap, HashMap, HashSet};

catalyst-toolbox/src/stats/voters.rs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ fn vote_counts_as_utxo(
4545
.filter_map(|initials| {
4646
if let Initial::Fund(funds) = initials {
4747
for utxo in funds {
48-
if let Some(vote_count) = votes_count.get(&addr_to_hex(&utxo.address)) {
49-
return Some((utxo.clone(), *vote_count as u32));
48+
if let Some(hash_set) = votes_count.get(&addr_to_id(&utxo.address)) {
49+
return Some((utxo.clone(), hash_set.len() as u32));
5050
}
5151
}
5252
}
@@ -55,12 +55,9 @@ fn vote_counts_as_utxo(
5555
.collect()
5656
}
5757

58-
pub fn addr_to_hex(address: &Address) -> String {
58+
pub fn addr_to_id(address: &Address) -> Identifier {
5959
match &address.1 .1 {
60-
Kind::Account(pk) => {
61-
let id: Identifier = pk.clone().into();
62-
id.to_hex()
63-
}
60+
Kind::Account(pk) => pk.clone().into(),
6461
_ => unimplemented!(),
6562
}
6663
}

0 commit comments

Comments
 (0)