File tree Expand file tree Collapse file tree 6 files changed +32
-30
lines changed
Expand file tree Collapse file tree 6 files changed +32
-30
lines changed Original file line number Diff line number Diff line change @@ -223,28 +223,36 @@ impl PartialOrd for ScoreHash {
223223 }
224224
225225 impl ProTxHash {
226- /// Create a Txid from a string
226+ /// Create a ProTxHash from a string
227227 pub fn from_hex ( s : & str ) -> Result < ProTxHash , Error > {
228228 Ok ( Self ( sha256d:: Hash :: from_str ( s) ?) )
229229 }
230230
231- /// Convert a Txid to a string
231+ /// Convert a ProTxHash to a string
232232 pub fn to_hex ( & self ) -> String {
233233 self . 0 . to_string ( )
234234 }
235235 }
236236
237237 impl ScoreHash {
238- /// Create a Txid from a string
238+ /// Create a ScoreHash from a string
239239 pub fn from_hex ( s : & str ) -> Result < ScoreHash , Error > {
240240 Ok ( Self ( sha256:: Hash :: from_str ( s) ?) )
241241 }
242242
243- /// Convert a Txid to a string
243+ /// Convert a ScoreHash to a string
244244 pub fn to_hex ( & self ) -> String {
245245 self . 0 . to_string ( )
246246 }
247247
248+ /// Creates a score based on the optional confirmed hash and the quorum modifier.
249+ ///
250+ /// # Arguments
251+ /// * `confirmed_hash_hashed_with_pro_reg_tx` - An optional hash combining the confirmed hash and ProRegTx.
252+ /// * `modifier` - A quorum modifier hash used in the calculation.
253+ ///
254+ /// # Returns
255+ /// * A hashed score derived from the input values.
248256 pub fn create_score ( confirmed_hash_hashed_with_pro_reg_tx : Option < ConfirmedHashHashedWithProRegTx > , modifier : QuorumModifierHash ) -> Self {
249257 let mut bytes = vec ! [ ] ;
250258 if let Some ( confirmed_hash_hashed_with_pro_reg_tx) = confirmed_hash_hashed_with_pro_reg_tx{
Original file line number Diff line number Diff line change @@ -154,7 +154,7 @@ impl Decodable for QRInfo {
154154pub struct QuorumSnapshot {
155155 pub skip_list_mode : MNSkipListMode ,
156156 pub active_quorum_members : Vec < bool > , // Bitset, length = (active_quorum_members_count + 7) / 8
157- pub skip_list : Vec < u32 > , // Array of int32_t
157+ pub skip_list : Vec < u32 > , // Array of uint32_t
158158}
159159
160160impl Display for QuorumSnapshot {
Original file line number Diff line number Diff line change @@ -23,12 +23,15 @@ impl Display for LLMQEntryVerificationSkipStatus {
2323 match self {
2424 LLMQEntryVerificationSkipStatus :: NotMarkedForVerification =>
2525 "NotMarkedForVerification" . to_string ( ) ,
26- LLMQEntryVerificationSkipStatus :: MissedList ( block_height) =>
27- format ! ( "MissedList({})" , block_height) ,
28- LLMQEntryVerificationSkipStatus :: UnknownBlock ( block_hash) =>
29- format ! ( "UnknownBlock({})" , hex:: encode( block_hash) ) ,
30- LLMQEntryVerificationSkipStatus :: OtherContext ( message) =>
31- format ! ( "OtherContext({message})" ) ,
26+ LLMQEntryVerificationSkipStatus :: MissedList ( block_height) => {
27+ format ! ( "MissedList({})" , block_height)
28+ }
29+ LLMQEntryVerificationSkipStatus :: UnknownBlock ( block_hash) => {
30+ format ! ( "UnknownBlock({})" , hex:: encode( block_hash) )
31+ }
32+ LLMQEntryVerificationSkipStatus :: OtherContext ( message) => {
33+ format ! ( "OtherContext({message})" )
34+ }
3235 }
3336 . as_str ( ) ,
3437 )
Original file line number Diff line number Diff line change @@ -151,17 +151,6 @@ pub const LLMQ_0024: LLMQParams = LLMQParams {
151151 keep_old_connections : 4 ,
152152 recovery_members : 4 ,
153153} ;
154- pub const LLMQ_0024_333 : LLMQParams = LLMQParams {
155- quorum_type : LLMQType :: LlmqtypeDevnetDIP0024 ,
156- name : "llmq_devnet_dip0024" ,
157- size : 8 ,
158- min_size : 6 ,
159- threshold : 4 ,
160- dkg_params : DKG_DEVNET_DIP_0024 ,
161- signing_active_quorum_count : 2 ,
162- keep_old_connections : 4 ,
163- recovery_members : 4 ,
164- } ;
165154pub const LLMQ_TEST_DIP00024 : LLMQParams = LLMQParams {
166155 quorum_type : LLMQType :: LlmqtypeTestDIP0024 ,
167156 name : "llmq_test_dip0024" ,
Original file line number Diff line number Diff line change @@ -382,11 +382,11 @@ impl MasternodeListEngine {
382382 snapshot
383383 . skip_list
384384 . iter ( )
385- . filter_map ( |unskipped | {
386- sorted_combined_mns_list. get ( * unskipped as usize )
385+ . filter_map ( |not_skipped | {
386+ sorted_combined_mns_list. get ( * not_skipped as usize )
387387 } )
388388 . take ( quarter_size)
389- . cloned ( )
389+ . copied ( )
390390 . collect ( )
391391 } )
392392 . collect ( ) ,
@@ -400,9 +400,9 @@ impl MasternodeListEngine {
400400 LLMQQuarterUsageType :: New ( mut used_indexed_masternodes) => {
401401 let mut quarter_quorum_members =
402402 vec ! [ Vec :: <& QualifiedMasternodeListEntry >:: new( ) ; quorum_count] ;
403- let mut skip_list = Vec :: < i32 > :: new ( ) ;
404- let mut first_skipped_index = 0i32 ;
405- let mut idx = 0i32 ;
403+ let mut skip_list = Vec :: < u32 > :: new ( ) ;
404+ let mut first_skipped_index = 0u32 ;
405+ let mut idx = 0u32 ;
406406 for i in 0 ..quorum_count {
407407 let masternodes_used_at_h_indexed_at_i = used_indexed_masternodes
408408 . get_mut ( i)
@@ -430,7 +430,7 @@ impl MasternodeListEngine {
430430 updated = true ;
431431 }
432432 idx += 1 ;
433- if idx == sorted_combined_mns_list_len as i32 {
433+ if idx == sorted_combined_mns_list_len as u32 {
434434 idx = 0 ;
435435 }
436436 if idx == initial_loop_idx {
Original file line number Diff line number Diff line change @@ -58,7 +58,9 @@ impl QualifiedQuorumEntry {
5858 . collect :: < Vec < _ > > ( ) ;
5959 let sig =
6060 G2Element :: from_bytes ( self . quorum_entry . all_commitment_aggregated_signature . as_bytes ( ) )
61- . expect ( "expected sig" ) ;
61+ . map_err ( |e| {
62+ QuorumValidationError :: AllCommitmentAggregatedSignatureNotValid ( e. to_string ( ) )
63+ } ) ?;
6264 let verified = BasicSchemeMPL :: new ( ) . verify_secure ( public_keys2. iter ( ) , message, & sig) ;
6365 if verified {
6466 Ok ( ( ) )
You can’t perform that action at this time.
0 commit comments