explicit header version based on height rather than "increment" the version (#3148)

This commit is contained in:
Antioch Peverell 2019-11-29 14:32:39 +00:00 committed by GitHub
parent ba9cdd323e
commit 869cfd2b82
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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 {
@ -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);