Skip to content

Commit b3084df

Browse files
committed
delay func
1 parent ce7c78f commit b3084df

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

txemulator/trace.go

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -219,9 +219,7 @@ func (t *Tracer) Run(ctx context.Context, message tlb.Message, signatureIgnoreDe
219219
return nil, err
220220
}
221221
for len(t.pending) > 0 {
222-
delay := rand.Intn(11) + 5 // random number between 5 and 15
223-
t.currentTime += uint32(delay)
224-
err = t.e.SetUnixtime(t.currentTime)
222+
err = t.addRandomDelay()
225223
if err != nil {
226224
return nil, err
227225
}
@@ -370,11 +368,10 @@ func (t *Tracer) run(ctx context.Context, message tlb.Message, signatureIgnoreDe
370368
return tree, err
371369
}
372370

373-
func (t *Tracer) addRandomDelay(currentTime uint32) error {
371+
func (t *Tracer) addRandomDelay() error {
374372
delay := rand.Intn(11) + 5 // random number between 5 and 15
375-
currentTime += uint32(delay)
376-
t.currentTime = currentTime
377-
return t.e.SetUnixtime(currentTime)
373+
t.currentTime += uint32(delay)
374+
return t.e.SetUnixtime(t.currentTime)
378375
}
379376

380377
func (t *Tracer) getAccountShard(account ton.AccountID) (ton.ShardID, error) {

0 commit comments

Comments
 (0)