Skip to content

Commit d67fb06

Browse files
authored
Merge pull request #7351 from multiversx/time-duration-fix-manual-round-handler
adapt round duration for supernova in chain simulator
2 parents 786daf9 + 7fdb96f commit d67fb06

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

node/chainSimulator/components/manualRoundHandler.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,12 @@ func (handler *manualRoundHandler) isSupernovaActive(roundIndex int64) bool {
9494

9595
// TimeDuration returns the provided time duration for this instance
9696
func (handler *manualRoundHandler) TimeDuration() time.Duration {
97-
return handler.roundDuration
97+
roundIndex := atomic.LoadInt64(&handler.index)
98+
if !handler.isSupernovaActive(roundIndex) {
99+
return handler.roundDuration
100+
}
101+
102+
return handler.supernovaRoundDuration
98103
}
99104

100105
// RemainingTime returns the max time as the start time is not taken into account

node/chainSimulator/components/manualRoundHandler_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,4 +92,5 @@ func TestManualRoundHandler_Operations(t *testing.T) {
9292
handler.IncrementIndex()
9393
}
9494
require.Equal(t, args.SupernovaGenesisTimeStamp, handler.TimeStamp().UnixMilli())
95+
require.Equal(t, args.SupernovaRoundDuration.Milliseconds(), handler.TimeDuration().Milliseconds())
9596
}

0 commit comments

Comments
 (0)