Skip to content

Commit

Permalink
explicit header version based on height rather than "increment" the v…
Browse files Browse the repository at this point in the history
…ersion (#3148)
  • Loading branch information
antiochp authored Nov 29, 2019
1 parent ba9cdd3 commit 869cfd2
Showing 1 changed file with 2 additions and 12 deletions.
14 changes: 2 additions & 12 deletions core/src/core/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -185,13 +185,6 @@ impl Default for HeaderVersion {
}
}

// self-conscious increment function courtesy of Jasper
impl HeaderVersion {
fn next(&self) -> Self {
Self(self.0 + 1)
}
}

impl HeaderVersion {
/// Constructor taking the provided version.
pub fn new(version: u16) -> HeaderVersion {
Expand Down Expand Up @@ -619,12 +612,9 @@ impl Block {
vec![],
)?;

// Determine the height and associated version for the new header.
let height = prev.height + 1;

let mut version = prev.version;
if !consensus::valid_header_version(height, version) {
version = version.next();
}
let version = consensus::header_version(height);

let now = Utc::now().timestamp();
let timestamp = DateTime::<Utc>::from_utc(NaiveDateTime::from_timestamp(now, 0), Utc);
Expand Down

0 comments on commit 869cfd2

Please sign in to comment.