Skip to content

Commit

Permalink
params: unused code
Browse files Browse the repository at this point in the history
  • Loading branch information
darioush committed Sep 10, 2024
1 parent cd5adc9 commit 70659d3
Showing 1 changed file with 0 additions and 48 deletions.
48 changes: 0 additions & 48 deletions params/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -378,32 +378,6 @@ func (c *ChainConfigExtra) CheckCompatible(newcfg_ *ChainConfig, headNumber *big
return nil
}

// isForkBlockIncompatible returns true if a fork scheduled at block s1 cannot be
// rescheduled to block s2 because head is already past the fork.
func isForkBlockIncompatible(s1, s2, head *big.Int) bool {
return (isBlockForked(s1, head) || isBlockForked(s2, head)) && !configBlockEqual(s1, s2)
}

// isBlockForked returns whether a fork scheduled at block s is active at the
// given head block. Whilst this method is the same as isTimestampForked, they
// are explicitly separate for clearer reading.
func isBlockForked(s, head *big.Int) bool {
if s == nil || head == nil {
return false
}
return s.Cmp(head) <= 0
}

func configBlockEqual(x, y *big.Int) bool {
if x == nil {
return y == nil
}
if y == nil {
return x == nil
}
return x.Cmp(y) == 0
}

// isForkTimestampIncompatible returns true if a fork scheduled at timestamp s1
// cannot be rescheduled to timestamp s2 because head is already past the fork.
func isForkTimestampIncompatible(s1, s2 *uint64, head uint64) bool {
Expand Down Expand Up @@ -434,28 +408,6 @@ func configTimestampEqual(x, y *uint64) bool {
// ChainConfig that would alter the past.
type ConfigCompatError = gethparams.ConfigCompatError

func newBlockCompatError(what string, storedblock, newblock *big.Int) *ConfigCompatError {
var rew *big.Int
switch {
case storedblock == nil:
rew = newblock
case newblock == nil || storedblock.Cmp(newblock) < 0:
rew = storedblock
default:
rew = newblock
}
err := &ConfigCompatError{
What: what,
StoredBlock: storedblock,
NewBlock: newblock,
RewindToBlock: 0,
}
if rew != nil && rew.Sign() > 0 {
err.RewindToBlock = rew.Uint64() - 1
}
return err
}

func newTimestampCompatError(what string, storedtime, newtime *uint64) *ConfigCompatError {
var rew *uint64
switch {
Expand Down

0 comments on commit 70659d3

Please sign in to comment.