mirror of
https://github.com/mimblewimble/grin.git
synced 2025-01-20 19:11:08 +03:00
explicit header version based on height rather than "increment" the version (#3148)
This commit is contained in:
parent
ba9cdd323e
commit
869cfd2b82
1 changed files with 2 additions and 12 deletions
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue