Skip to content

Commit ae41384

Browse files
clean up
1 parent 5b36174 commit ae41384

File tree

13 files changed

+36
-34
lines changed

13 files changed

+36
-34
lines changed

dash/src/blockdata/transaction/special_transaction/provider_registration.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,12 @@
3434
//! KeyIdVoting (renamed to voting_key_hash): This is the public key ID used for proposal voting.
3535
//! Votes signed with this key are valid while the masternode is in the registered set.
3636
37+
use std::net::SocketAddr;
38+
3739
#[cfg(feature = "bincode")]
3840
use bincode::{Decode, Encode};
3941
use hashes::Hash;
4042
use internals::hex::Case::Lower;
41-
use std::net::SocketAddr;
4243

4344
use crate::address::Payload;
4445
use crate::blockdata::transaction::special_transaction::SpecialTransactionBasePayloadEncodable;
@@ -257,9 +258,10 @@ impl Decodable for ProviderRegistrationPayload {
257258

258259
#[cfg(test)]
259260
mod tests {
261+
use std::net::{Ipv4Addr, SocketAddr, SocketAddrV4};
262+
260263
use hashes::Hash;
261264
use hashes::hex::FromHex;
262-
use std::net::{Ipv4Addr, SocketAddr, SocketAddrV4};
263265

264266
use crate::bls_sig_utils::BLSPublicKey;
265267
use crate::consensus::{Encodable, deserialize};
@@ -272,10 +274,11 @@ mod tests {
272274

273275
#[cfg(feature = "signer")]
274276
mod signer {
277+
use internals::hex::display::DisplayHex;
278+
275279
use super::*;
276280
use crate::Network;
277281
use crate::transaction::special_transaction::SpecialTransactionBasePayloadEncodable;
278-
use internals::hex::display::DisplayHex;
279282

280283
#[test]
281284
fn test_collateral_provider_registration_transaction() {

dash/src/network/message_sml.rs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,21 @@ pub struct MnListDiff {
6464
pub quorums_chainlock_signatures: Vec<QuorumCLSigObject>,
6565
}
6666

67-
impl_consensus_encoding!(MnListDiff, version, base_block_hash, block_hash, total_transactions, merkle_hashes, merkle_flags, coinbase_tx, deleted_masternodes, new_masternodes, deleted_quorums, new_quorums, quorums_chainlock_signatures);
67+
impl_consensus_encoding!(
68+
MnListDiff,
69+
version,
70+
base_block_hash,
71+
block_hash,
72+
total_transactions,
73+
merkle_hashes,
74+
merkle_flags,
75+
coinbase_tx,
76+
deleted_masternodes,
77+
new_masternodes,
78+
deleted_quorums,
79+
new_quorums,
80+
quorums_chainlock_signatures
81+
);
6882

6983
#[derive(PartialEq, Eq, Clone, Debug)]
7084
#[cfg_attr(feature = "bincode", derive(Encode, Decode))]

dash/src/sml/address.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,10 @@ impl Decodable for SocketAddr {
4646

4747
#[cfg(test)]
4848
mod tests {
49-
use super::*;
5049
use std::net::Ipv4Addr;
5150

51+
use super::*;
52+
5253
#[test]
5354
fn encode_decode_ipv4() {
5455
let ip = Ipv4Addr::new(192, 168, 1, 1);

dash/src/sml/llmq_entry_verification.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ use core::fmt::{Display, Formatter};
22

33
#[cfg(feature = "bincode")]
44
use bincode::{Decode, Encode};
5+
56
use crate::BlockHash;
67
use crate::prelude::CoreBlockHeight;
78
use crate::sml::quorum_validation_error::QuorumValidationError;

dash/src/sml/masternode_list/builder.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1+
use std::collections::BTreeMap;
2+
13
use crate::hash_types::{MerkleRootMasternodeList, MerkleRootQuorums};
24
use crate::sml::llmq_type::LLMQType;
35
use crate::sml::masternode_list::MasternodeList;
46
use crate::sml::masternode_list_entry::qualified_masternode_list_entry::QualifiedMasternodeListEntry;
57
use crate::sml::quorum_entry::qualified_quorum_entry::QualifiedQuorumEntry;
68
use crate::{BlockHash, ProTxHash, QuorumHash};
7-
use std::collections::BTreeMap;
89

910
pub struct MasternodeListBuilder {
1011
pub block_hash: BlockHash,

dash/src/sml/masternode_list/masternode_helpers.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
use std::net::IpAddr;
2+
23
use crate::ProTxHash;
34
use crate::sml::masternode_list::MasternodeList;
45

dash/src/sml/masternode_list/mod.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,9 @@ mod scores_for_quorum;
1212

1313
use std::collections::BTreeMap;
1414

15-
pub use builder::MasternodeListBuilder;
16-
1715
#[cfg(feature = "bincode")]
1816
use bincode::{Decode, Encode};
17+
pub use builder::MasternodeListBuilder;
1918

2019
use crate::hash_types::{MerkleRootMasternodeList, MerkleRootQuorums};
2120
use crate::sml::llmq_type::LLMQType;

dash/src/sml/masternode_list_engine/message_request_verification.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ impl MasternodeListEngine {
1111
fn is_lock_potential_quorums(
1212
&self,
1313
instant_lock: &InstantLock,
14-
) -> Result<(&Vec<QualifiedQuorumEntry>), MessageVerificationError> {
14+
) -> Result<&Vec<QualifiedQuorumEntry>, MessageVerificationError> {
1515
// Retrieve the cycle hash from the Instant Lock
1616
let cycle_hash = instant_lock.cyclehash;
1717

dash/src/sml/masternode_list_engine/mod.rs

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -923,7 +923,7 @@ mod tests {
923923
let block_hex =
924924
include_str!("../../../tests/data/test_DML_diffs/masternode_list_engine.hex");
925925
let data = hex::decode(block_hex).expect("decode hex");
926-
let mut mn_list_engine: MasternodeListEngine =
926+
let mn_list_engine: MasternodeListEngine =
927927
bincode::decode_from_slice(&data, bincode::config::standard())
928928
.expect("expected to decode")
929929
.0;
@@ -943,7 +943,7 @@ mod tests {
943943
let block_hex =
944944
include_str!("../../../tests/data/test_DML_diffs/masternode_list_engine.hex");
945945
let data = hex::decode(block_hex).expect("decode hex");
946-
let mut mn_list_engine: MasternodeListEngine =
946+
let mn_list_engine: MasternodeListEngine =
947947
bincode::decode_from_slice(&data, bincode::config::standard())
948948
.expect("expected to decode")
949949
.0;
@@ -954,19 +954,4 @@ mod tests {
954954
.expect("expected to validated quorums");
955955
}
956956
}
957-
958-
// #[test]
959-
// fn deserialize_mn_list_engine_and_validate_rotated_quorums() {
960-
// let block_hex = include_str!("../../../tests/data/test_DML_diffs/masternode_list_engine.hex");
961-
// let data = hex::decode(block_hex).expect("decode hex");
962-
// let mut mn_list_engine: MasternodeListEngine = bincode::decode_from_slice(&data, bincode::config::standard()).expect("expected to decode").0;
963-
//
964-
// assert_eq!(mn_list_engine.masternode_lists.len(), 27);
965-
//
966-
// // height 2227678
967-
//
968-
// for quorum in &mn_list_engine.last_commitment_entries {
969-
// mn_list_engine.validate_quorum(quorum).expect("expected to validate quorum");
970-
// }
971-
// }
972957
}

dash/src/sml/masternode_list_entry/hash.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use hashes::{sha256d, Hash};
1+
use hashes::{Hash, sha256d};
22

33
use crate::consensus::Encodable;
44
use crate::sml::masternode_list_entry::MasternodeListEntry;

0 commit comments

Comments
 (0)