Skip to content

Commit 81a809f

Browse files
fixes
1 parent 6bad92b commit 81a809f

File tree

4 files changed

+24
-10
lines changed

4 files changed

+24
-10
lines changed

dash/src/network/message.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -239,9 +239,9 @@ pub enum NetworkMessage {
239239
/// `mnlistdiff`
240240
MnListDiff(message_sml::MnListDiff),
241241
/// `getqrinfo`
242-
GetQRInfo(message_qrinfo::GetQrInfo),
242+
GetQRInfo(message_qrinfo::GetQRInfo),
243243
/// `qrinfo`
244-
QrInfo(message_qrinfo::QrInfo),
244+
QRInfo(message_qrinfo::QRInfo),
245245
/// Any other message.
246246
Unknown {
247247
/// The command of this message.
@@ -298,7 +298,7 @@ impl NetworkMessage {
298298
NetworkMessage::GetMnListD(_) => "getmnlistd",
299299
NetworkMessage::MnListDiff(_) => "mnlistdiff",
300300
NetworkMessage::GetQRInfo(_) => "getqrinfo",
301-
NetworkMessage::QrInfo(_) => "qrinfo",
301+
NetworkMessage::QRInfo(_) => "qrinfo",
302302
NetworkMessage::Unknown { .. } => "unknown",
303303
}
304304
}
@@ -385,7 +385,7 @@ impl Encodable for RawNetworkMessage {
385385
NetworkMessage::GetMnListD(ref dat) => serialize(dat),
386386
NetworkMessage::MnListDiff(ref dat) => serialize(dat),
387387
NetworkMessage::GetQRInfo(ref dat) => serialize(dat),
388-
NetworkMessage::QrInfo(ref dat) => serialize(dat),
388+
NetworkMessage::QRInfo(ref dat) => serialize(dat),
389389
})
390390
.consensus_encode(w)?;
391391
Ok(len)

dash/src/network/message_qrinfo.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ use crate::network::message_sml::MnListDiff;
1313
/// - `block_request_hash`: Hash of the block for which the masternode list diff is requested
1414
/// - `extra_share`: Optional flag to indicate if an extra share is requested (defaults to false)
1515
#[derive(PartialEq, Eq, Clone, Debug)]
16-
pub struct GetQrInfo {
16+
pub struct GetQRInfo {
1717
pub base_block_hashes: Vec<BlockHash>,
1818
pub block_request_hash: BlockHash,
1919
pub extra_share: bool,
2020
}
2121

22-
impl_consensus_encoding!(GetQrInfo,
22+
impl_consensus_encoding!(GetQRInfo,
2323
base_block_hashes,
2424
block_request_hash,
2525
extra_share
@@ -31,7 +31,7 @@ impl_consensus_encoding!(GetQrInfo,
3131
///
3232
/// Note: The “compact size” integers that prefix some arrays are handled by your consensus encoding routines.
3333
#[derive(PartialEq, Eq, Clone, Debug)]
34-
pub struct QrInfo {
34+
pub struct QRInfo {
3535
// Quorum snapshots for heights h-c, h-2c, h-3c.
3636
pub quorum_snapshot_at_h_minus_c: QuorumSnapshot,
3737
pub quorum_snapshot_at_h_minus_2c: QuorumSnapshot,
@@ -60,7 +60,7 @@ pub struct QrInfo {
6060
pub mn_list_diff_list: Vec<MnListDiff>,
6161
}
6262

63-
impl Encodable for QrInfo {
63+
impl Encodable for QRInfo {
6464
fn consensus_encode<W: io::Write + ?Sized>(&self, w: &mut W) -> Result<usize, io::Error> {
6565
let mut len = 0;
6666
// Encode the three required quorum snapshots.
@@ -90,7 +90,7 @@ impl Encodable for QrInfo {
9090
}
9191
}
9292

93-
impl Decodable for QrInfo {
93+
impl Decodable for QRInfo {
9494
fn consensus_decode<R: io::Read + ?Sized>(r: &mut R) -> Result<Self, encode::Error> {
9595
// Decode the three quorum snapshots.
9696
let quorum_snapshot_at_h_minus_c = QuorumSnapshot::consensus_decode(r)?;
@@ -119,7 +119,7 @@ impl Decodable for QrInfo {
119119
let quorum_snapshot_list = Vec::consensus_decode(r)?;
120120
let mn_list_diff_list = Vec::consensus_decode(r)?;
121121

122-
Ok(QrInfo {
122+
Ok(QRInfo {
123123
quorum_snapshot_at_h_minus_c,
124124
quorum_snapshot_at_h_minus_2c,
125125
quorum_snapshot_at_h_minus_3c,

dash/src/sml/masternode_list/quorum_helpers.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,14 @@ impl MasternodeList {
3030
.collect()
3131
}
3232

33+
pub fn rotating_quorum_hashes(&self, exclude_quorum_types: &[LLMQType]) -> BTreeSet<QuorumHash> {
34+
self.quorums
35+
.iter()
36+
.filter(|(llmq_type, _)| llmq_type.is_rotating_quorum_type() && !exclude_quorum_types.contains(llmq_type))
37+
.flat_map(|(_, quorums)| quorums.keys().cloned())
38+
.collect()
39+
}
40+
3341
pub fn quorum_entry_of_type_for_quorum_hash(
3442
&self,
3543
llmq_type: LLMQType,

dash/src/sml/masternode_list_engine/mod.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,12 @@ impl MasternodeListEngine {
5959
.unwrap_or_default()
6060
}
6161

62+
pub fn latest_masternode_list_rotating_quorum_hashes(&self, exclude_quorum_types: &[LLMQType]) -> BTreeSet<QuorumHash> {
63+
self.latest_masternode_list()
64+
.map(|list| list.rotating_quorum_hashes(exclude_quorum_types))
65+
.unwrap_or_default()
66+
}
67+
6268
pub fn masternode_list_and_height_for_block_hash_8_blocks_ago(
6369
&self,
6470
block_hash: &BlockHash,

0 commit comments

Comments
 (0)