From 0ed16b0739a340b737fa704da43d00b819fde20c Mon Sep 17 00:00:00 2001 From: colin <102356659+colinlyguo@users.noreply.github.com> Date: Thu, 22 Aug 2024 00:36:21 +0800 Subject: [PATCH] feat: add darwinv2 in genesis config (#993) * feat: add darwinv2 in genesis config * bump version * fix typo * Update params/config.go Co-authored-by: georgehao --------- Co-authored-by: georgehao --- params/config.go | 6 ++++++ params/version.go | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/params/config.go b/params/config.go index c211ccd0d4..44c1292cb0 100644 --- a/params/config.go +++ b/params/config.go @@ -625,6 +625,7 @@ type ChainConfig struct { BernoulliBlock *big.Int `json:"bernoulliBlock,omitempty"` // Bernoulli switch block (nil = no fork, 0 = already on bernoulli) CurieBlock *big.Int `json:"curieBlock,omitempty"` // Curie switch block (nil = no fork, 0 = already on curie) DarwinTime *uint64 `json:"darwinTime,omitempty"` // Darwin switch time (nil = no fork, 0 = already on darwin) + DarwinV2Time *uint64 `json:"darwinv2Time,omitempty"` // DarwinV2 switch time (nil = no fork, 0 = already on darwinv2) // TerminalTotalDifficulty is the amount of total difficulty reached by // the network that triggers the consensus upgrade. @@ -861,6 +862,11 @@ func (c *ChainConfig) IsDarwin(now uint64) bool { return isForkedTime(now, c.DarwinTime) } +// IsDarwinV2 returns whether num is either equal to the DarwinV2 fork block or greater. +func (c *ChainConfig) IsDarwinV2(now uint64) bool { + return isForkedTime(now, c.DarwinV2Time) +} + // IsTerminalPoWBlock returns whether the given block is the last block of PoW stage. func (c *ChainConfig) IsTerminalPoWBlock(parentTotalDiff *big.Int, totalDiff *big.Int) bool { if c.TerminalTotalDifficulty == nil { diff --git a/params/version.go b/params/version.go index 77bb908849..0d8aacfff0 100644 --- a/params/version.go +++ b/params/version.go @@ -24,7 +24,7 @@ import ( const ( VersionMajor = 5 // Major version component of the current release VersionMinor = 6 // Minor version component of the current release - VersionPatch = 1 // Patch version component of the current release + VersionPatch = 2 // Patch version component of the current release VersionMeta = "mainnet" // Version metadata to append to the version string )