Luther Blissett 3 лет назад
Родитель
Сommit
65308c49e7
1 измененных файлов с 4 добавлено и 16 удалено
  1. 4 16
      src/consensus/metadata.rs

+ 4 - 16
src/consensus/metadata.rs

@@ -15,7 +15,7 @@ use crate::{
     VerifyResult,
     VerifyResult,
 };
 };
 
 
-#[derive(Debug, Clone, PartialEq, SerialEncodable, SerialDecodable)]
+#[derive(Debug, Clone, PartialEq, Eq, SerialEncodable, SerialDecodable)]
 pub struct StakeholderMetadata {
 pub struct StakeholderMetadata {
     /// Block owner signature
     /// Block owner signature
     pub signature: Signature,
     pub signature: Signature,
@@ -39,21 +39,15 @@ impl StakeholderMetadata {
 }
 }
 
 
 /// wrapper over the Proof, for possiblity any metadata necessary in the future.
 /// wrapper over the Proof, for possiblity any metadata necessary in the future.
-#[derive(Debug, Clone, PartialEq, SerialEncodable, SerialDecodable)]
+#[derive(Default, Debug, Clone, PartialEq, Eq, SerialEncodable, SerialDecodable)]
 pub struct TransactionLeadProof {
 pub struct TransactionLeadProof {
     /// leadership proof
     /// leadership proof
     pub lead_proof: Proof,
     pub lead_proof: Proof,
 }
 }
 
 
-impl Default for TransactionLeadProof {
-    fn default() -> Self {
-        Self { lead_proof: Proof::default() }
-    }
-}
-
 impl TransactionLeadProof {
 impl TransactionLeadProof {
     pub fn new(pk: &ProvingKey, coin: LeadCoin) -> Self {
     pub fn new(pk: &ProvingKey, coin: LeadCoin) -> Self {
-        let proof = lead_proof::create_lead_proof(pk, coin.clone()).unwrap();
+        let proof = lead_proof::create_lead_proof(pk, coin).unwrap();
         Self { lead_proof: proof }
         Self { lead_proof: proof }
     }
     }
 
 
@@ -70,7 +64,7 @@ impl From<Proof> for TransactionLeadProof {
 
 
 /// This struct represents [`Block`](super::Block) information used by the Ouroboros
 /// This struct represents [`Block`](super::Block) information used by the Ouroboros
 /// Praos consensus protocol.
 /// Praos consensus protocol.
-#[derive(Debug, Clone, PartialEq, SerialEncodable, SerialDecodable)]
+#[derive(Default, Debug, Clone, PartialEq, Eq, SerialEncodable, SerialDecodable)]
 pub struct OuroborosMetadata {
 pub struct OuroborosMetadata {
     /// response of global random oracle, or it's emulation.
     /// response of global random oracle, or it's emulation.
     pub eta: [u8; 32],
     pub eta: [u8; 32],
@@ -78,12 +72,6 @@ pub struct OuroborosMetadata {
     pub lead_proof: TransactionLeadProof,
     pub lead_proof: TransactionLeadProof,
 }
 }
 
 
-impl Default for OuroborosMetadata {
-    fn default() -> Self {
-        Self { eta: [0; 32], lead_proof: TransactionLeadProof::default() }
-    }
-}
-
 impl OuroborosMetadata {
 impl OuroborosMetadata {
     pub fn new(eta: [u8; 32], lead_proof: TransactionLeadProof) -> Self {
     pub fn new(eta: [u8; 32], lead_proof: TransactionLeadProof) -> Self {
         Self { eta, lead_proof }
         Self { eta, lead_proof }