File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed
mithril-common/src/crypto_helper/cardano Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -117,6 +117,13 @@ impl OpCert {
117
117
. map_err ( |_| OpCertError :: PoolAddressEncoding )
118
118
}
119
119
120
+ /// Compute protocol party id as hash
121
+ pub fn compute_protocol_party_id_as_hash ( & self ) -> String {
122
+ let mut hasher = Blake2b :: < U28 > :: new ( ) ;
123
+ hasher. update ( self . cold_vk . as_bytes ( ) ) ;
124
+ hex:: encode ( hasher. finalize ( ) )
125
+ }
126
+
120
127
/// Compute the hash of an OpCert
121
128
pub fn compute_hash ( & self ) -> String {
122
129
let mut hasher = Sha256 :: new ( ) ;
@@ -207,5 +214,11 @@ mod tests {
207
214
"pool1mxyec46067n3querj9cxkk0g0zlag93pf3ya9vuyr3wgkq2e6t7" . to_string( ) ,
208
215
party_id
209
216
) ;
217
+
218
+ let party_id_as_hash = operational_certificate. compute_protocol_party_id_as_hash ( ) ;
219
+ assert_eq ! (
220
+ "d9899c574fd7a710732391706b59e878bfd416214c49d2b3841c5c8b" . to_string( ) ,
221
+ party_id_as_hash
222
+ ) ;
210
223
}
211
224
}
You can’t perform that action at this time.
0 commit comments