Implemented right way to constrain zone difficulty.

This commit is contained in:
Revertron
2021-03-17 14:55:05 +01:00
parent d8ac1e3c32
commit 1d9833db0f
10 changed files with 95 additions and 36 deletions
+19
View File
@@ -5,6 +5,7 @@ use serde::ser::SerializeStruct;
use crate::blockchain::hash_utils::*;
use crate::bytes::Bytes;
use crate::dns::protocol::DnsRecord;
extern crate serde;
extern crate serde_json;
@@ -75,4 +76,22 @@ impl Serialize for Transaction {
structure.serialize_field("pub_key", &self.pub_key)?;
structure.end()
}
}
#[derive(Clone, Serialize, Deserialize, PartialEq)]
pub struct DomainData {
pub zone: String,
pub records: Vec<DnsRecord>
}
impl DomainData {
pub fn new(zone: String, records: Vec<DnsRecord>) -> Self {
Self { zone, records }
}
}
#[derive(Clone, Serialize, Deserialize, PartialEq)]
pub struct ZoneData {
pub name: String,
pub difficulty: u32
}