Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cleanup HeaderVersion::default() #3149

Merged
merged 3 commits into from
Dec 2, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 1 addition & 7 deletions core/src/core/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,12 +179,6 @@ impl Hashed for HeaderEntry {
#[derive(Clone, Copy, Debug, Eq, PartialEq, Serialize)]
pub struct HeaderVersion(pub u16);

impl Default for HeaderVersion {
fn default() -> HeaderVersion {
HeaderVersion(1)
}
}

impl From<HeaderVersion> for u16 {
fn from(v: HeaderVersion) -> u16 {
v.0
Expand Down Expand Up @@ -239,7 +233,7 @@ impl DefaultHashable for BlockHeader {}
impl Default for BlockHeader {
fn default() -> BlockHeader {
BlockHeader {
version: HeaderVersion::default(),
version: HeaderVersion(1),
height: 0,
timestamp: DateTime::<Utc>::from_utc(NaiveDateTime::from_timestamp(0, 0), Utc),
prev_hash: ZERO_HASH,
Expand Down
2 changes: 1 addition & 1 deletion core/tests/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ fn serialize_deserialize_header_version() {
ser::serialize_default(&mut vec1, &1_u16).expect("serialization failed");

let mut vec2 = Vec::new();
ser::serialize_default(&mut vec2, &HeaderVersion::default()).expect("serialization failed");
ser::serialize_default(&mut vec2, &HeaderVersion(1)).expect("serialization failed");

// Check that a header_version serializes to a
// single u16 value with no extraneous bytes wrapping it.
Expand Down