Skip to content

Commit 5ad624c

Browse files
more fixes
1 parent 4259d30 commit 5ad624c

File tree

2 files changed

+50
-19
lines changed

2 files changed

+50
-19
lines changed

dash/src/hash_types.rs

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -148,12 +148,12 @@ use crate::transaction::special_transaction::quorum_commitment::QuorumEntry;
148148
pub struct QuorumCommitmentHash(sha256d::Hash);
149149

150150
pub struct Sha256dHash(sha256d::Hash);
151-
151+
pub struct QuorumOrderingHash(sha256d::Hash);
152152
}
153153

154154
hash_newtype_no_ord! {
155155
pub struct ScoreHash(sha256::Hash);
156-
pub struct QuorumOrderingHash(sha256d::Hash);
156+
157157
}
158158

159159
impl Ord for ScoreHash {
@@ -168,29 +168,29 @@ impl Ord for ScoreHash {
168168
}
169169
}
170170

171-
impl Ord for QuorumOrderingHash {
172-
fn cmp(&self, other: &Self) -> Ordering {
173-
let mut self_bytes = self.0.to_byte_array();
174-
let mut other_bytes = other.0.to_byte_array();
175-
176-
self_bytes.reverse();
177-
other_bytes.reverse();
178-
179-
self_bytes.cmp(&other_bytes)
180-
}
181-
}
171+
// impl Ord for QuorumOrderingHash {
172+
// fn cmp(&self, other: &Self) -> Ordering {
173+
// let mut self_bytes = self.0.to_byte_array();
174+
// let mut other_bytes = other.0.to_byte_array();
175+
//
176+
// self_bytes.reverse();
177+
// other_bytes.reverse();
178+
//
179+
// self_bytes.cmp(&other_bytes)
180+
// }
181+
// }
182182

183183
impl PartialOrd for ScoreHash {
184184
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
185185
Some(self.cmp(other))
186186
}
187187
}
188188

189-
impl PartialOrd for QuorumOrderingHash {
190-
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
191-
Some(self.cmp(other))
192-
}
193-
}
189+
// impl PartialOrd for QuorumOrderingHash {
190+
// fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
191+
// Some(self.cmp(other))
192+
// }
193+
// }
194194

195195

196196
/// A hash used to identify a quorum
@@ -305,7 +305,7 @@ impl PartialOrd for ScoreHash {
305305
/// * A hashed score derived from the input values.
306306
pub fn create(quorum: &QuorumEntry, request_id: &QuorumSigningRequestId) -> Self {
307307
let mut bytes = vec![quorum.llmq_type as u8];
308-
bytes.extend_from_slice(quorum.quorum_hash.reverse().as_byte_array());
308+
bytes.extend_from_slice(quorum.quorum_hash.as_byte_array());
309309
bytes.extend_from_slice(request_id.as_byte_array());
310310
Self::hash(bytes.as_slice())
311311
}

dash/src/sml/masternode_list_engine/message_request_verification.rs

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -436,5 +436,36 @@ mod tests {
436436
assert_eq!(quorum.quorum_entry.quorum_hash, expected_quorum_hash);
437437

438438
mn_list_engine.verify_chain_lock(&chain_lock).expect("expected to verify chain lock");
439+
440+
// let's do another to make sure it wasn't a 1/4 fluke
441+
442+
let chain_lock = ChainLock {
443+
block_height: 2229203,
444+
block_hash: BlockHash::from_slice(hex::decode("0000000000000009ea873df6f4ab3bb1ea744e5630928cb8a4b4bd68aa16b18a").unwrap().as_slice()).unwrap().reverse(),
445+
signature: BLSSignature::from_hex("8723bf0a12abf41830936d8702ae57bb4f5ef7f816522f72e6da414081402d50a747a6307c91b15c0ee97fcfda60a7c50cdafa394c06b77299d9b9e4826fa1625c5436a2e3dc2e98df071dce92bbfc4445c87f7015b1914b17954b139dd8eafe").unwrap(),
446+
};
447+
448+
let request_id = chain_lock.request_id().expect("expected to make request id");
449+
assert_eq!(
450+
hex::encode(request_id),
451+
"10a808c18307e3993dd4aa996d032b6b5d9d30a5d75ddf64fa10ea35ee63b2bb"
452+
);
453+
454+
let quorum = mn_list_engine
455+
.chain_lock_potential_quorum_under(&chain_lock)
456+
.expect("expected under")
457+
.expect("expected");
458+
459+
let expected_quorum_hash: QuorumHash = QuorumHash::from_slice(
460+
hex::decode("000000000000001de4e594585627fb5e2612ef983c913ee13add9a454e5faa6d")
461+
.expect("expected bytes")
462+
.as_slice(),
463+
)
464+
.expect("expected quorum hash")
465+
.reverse();
466+
467+
//assert_eq!(quorum.quorum_entry.quorum_hash, expected_quorum_hash);
468+
469+
mn_list_engine.verify_chain_lock(&chain_lock).expect("expected to verify chain lock");
439470
}
440471
}

0 commit comments

Comments
 (0)