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 74f716f
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions cmd/evm/internal/t8ntool/transition.go
Expand Up @@ -259,11 +259,12 @@ 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)
env.ParentTimestamp, env.ParentDsifficulty, env.ParentUncleHash)
}
// Run the test and aggregate the result
s, result, err := prestate.Apply(vmConfig, chainConfig, txs, ctx.Int64(RewardFlag.Name), getTracer)
Expand Down

0 comments on commit 74f716f

Please sign in to comment.