File tree Expand file tree Collapse file tree 2 files changed +8
-10
lines changed Expand file tree Collapse file tree 2 files changed +8
-10
lines changed Original file line number Diff line number Diff line change 1- use crate :: snapshot:: { registration:: MainnetRewardAddress , SnapshotInfo } ;
2- use jormungandr_lib:: crypto:: { account:: Identifier , hash:: Hash } ;
31use chain_addr:: { Discrimination , Kind } ;
42use 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+ } ;
67use rust_decimal:: Decimal ;
78use snapshot_lib:: { registration:: MainnetRewardAddress , SnapshotInfo } ;
89use std:: collections:: { BTreeMap , HashMap , HashSet } ;
Original file line number Diff line number Diff 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}
You can’t perform that action at this time.
0 commit comments