Skip to content

Commit 04a7c52

Browse files
committed
internal/t8ntool: fix error condition
1 parent fa218f1 commit 04a7c52

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

cmd/evm/internal/t8ntool/transition.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -259,8 +259,9 @@ func Main(ctx *cli.Context) error {
259259
return NewError(ErrorVMConfig, errors.New("currentDifficulty was not provided, and cannot be calculated due to missing parentDifficulty"))
260260
case env.Number == 0:
261261
return NewError(ErrorVMConfig, errors.New("currentDifficulty needs to be provided for block number 0"))
262-
case env.Timestamp == 0:
263-
return NewError(ErrorVMConfig, errors.New("currentDifficulty cannot be calculated if time is set to 0"))
262+
case env.Timestamp <= env.ParentTimestamp:
263+
return NewError(ErrorVMConfig, fmt.Errorf("currentDifficulty cannot be calculated -- currentTime (%d) needs to be after parent time (%d)",
264+
env.Timestamp, env.ParentTimestamp))
264265
}
265266
prestate.Env.Difficulty = calcDifficulty(chainConfig, env.Number, env.Timestamp,
266267
env.ParentTimestamp, env.ParentDifficulty, env.ParentUncleHash)

0 commit comments

Comments
 (0)