Skip to content

Commit

Permalink
internal/t8ntool: fix error condition
Browse files Browse the repository at this point in the history
  • Loading branch information
holiman committed Aug 25, 2021
1 parent fa218f1 commit 04a7c52
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions cmd/evm/internal/t8ntool/transition.go
Expand Up @@ -259,8 +259,9 @@ func Main(ctx *cli.Context) error {
return NewError(ErrorVMConfig, errors.New("currentDifficulty was not provided, and cannot be calculated due to missing parentDifficulty"))
case env.Number == 0:
return NewError(ErrorVMConfig, errors.New("currentDifficulty needs to be provided for block number 0"))
case env.Timestamp == 0:
return NewError(ErrorVMConfig, errors.New("currentDifficulty cannot be calculated if time is set to 0"))
case env.Timestamp <= env.ParentTimestamp:
return NewError(ErrorVMConfig, fmt.Errorf("currentDifficulty cannot be calculated -- currentTime (%d) needs to be after parent time (%d)",
env.Timestamp, env.ParentTimestamp))
}
prestate.Env.Difficulty = calcDifficulty(chainConfig, env.Number, env.Timestamp,
env.ParentTimestamp, env.ParentDifficulty, env.ParentUncleHash)
Expand Down

0 comments on commit 04a7c52

Please sign in to comment.