Cleanup redundant AsFixedBytes and FixedLength traits (#3131)

* no need for AsFixedBytes we can just use AsRef<[u8]>

* cleanup FixedLength trait

* revert this change for now

* fix store tests

* cleanup and fix tests after rebase

* fix tests

* update based on PR review
less hard-coded values now

* cleanup
This commit is contained in:
Antioch Peverell
2020-01-29 13:41:50 +00:00
committed by GitHub
parent 83a2649946
commit 616dad43fd
15 changed files with 112 additions and 265 deletions
+4 -3
View File
@@ -17,7 +17,7 @@ use crate::core::hash::{DefaultHashable, Hashed};
use crate::global;
use crate::pow::common::EdgeType;
use crate::pow::error::Error;
use crate::ser::{self, FixedLength, Readable, Reader, Writeable, Writer};
use crate::ser::{self, Readable, Reader, Writeable, Writer};
use rand::{thread_rng, Rng};
use serde::{de, Deserialize, Deserializer, Serialize, Serializer};
/// Types for a Cuck(at)oo proof of work and its encapsulation as a fully usable
@@ -156,8 +156,9 @@ impl Readable for Difficulty {
}
}
impl FixedLength for Difficulty {
const LEN: usize = 8;
impl Difficulty {
/// Difficulty is 8 bytes.
pub const LEN: usize = 8;
}
impl Serialize for Difficulty {