@@ -395,11 +395,11 @@ func (h *Handler) EmulateMessageToAccountEvent(ctx context.Context, request *oas
395
395
if err != nil {
396
396
return nil , toError (http .StatusBadRequest , err )
397
397
}
398
- trace , _ , err := h .storage .GetTraceWithState (ctx , hash )
398
+ trace , version , _ , err := h .storage .GetTraceWithState (ctx , hash )
399
399
if err != nil {
400
400
h .logger .Warn ("get trace from storage: " , zap .Error (err ))
401
401
}
402
- if trace == nil {
402
+ if trace == nil || h . tongoVersion == 0 || version > h . tongoVersion {
403
403
configBase64 , err := h .storage .TrimmedConfigBase64 ()
404
404
if err != nil {
405
405
return nil , toError (http .StatusInternalServerError , err )
@@ -424,7 +424,7 @@ func (h *Handler) EmulateMessageToAccountEvent(ctx context.Context, request *oas
424
424
if err != nil {
425
425
return nil , toError (http .StatusInternalServerError , err )
426
426
}
427
- err = h .storage .SaveTraceWithState (ctx , hash , trace , []abi.MethodInvocation {}, 24 * time .Hour )
427
+ err = h .storage .SaveTraceWithState (ctx , hash , trace , h . tongoVersion , []abi.MethodInvocation {}, 24 * time .Hour )
428
428
if err != nil {
429
429
fmt .Println ("trace not saved: " , err )
430
430
}
@@ -456,11 +456,11 @@ func (h *Handler) EmulateMessageToEvent(ctx context.Context, request *oas.Emulat
456
456
if err != nil {
457
457
return nil , toError (http .StatusBadRequest , err )
458
458
}
459
- trace , _ , err = h .storage .GetTraceWithState (ctx , hs )
459
+ trace , version , _ , err : = h .storage .GetTraceWithState (ctx , hs )
460
460
if err != nil {
461
461
h .logger .Warn ("get trace from storage: " , zap .Error (err ))
462
462
}
463
- if trace == nil {
463
+ if trace == nil || h . tongoVersion == 0 || version > h . tongoVersion {
464
464
var m tlb.Message
465
465
if err := tlb .Unmarshal (c , & m ); err != nil {
466
466
return nil , toError (http .StatusBadRequest , err )
@@ -489,7 +489,7 @@ func (h *Handler) EmulateMessageToEvent(ctx context.Context, request *oas.Emulat
489
489
if err != nil {
490
490
return nil , toError (http .StatusInternalServerError , err )
491
491
}
492
- err = h .storage .SaveTraceWithState (ctx , hs , trace , []abi.MethodInvocation {}, 24 * time .Hour )
492
+ err = h .storage .SaveTraceWithState (ctx , hs , trace , h . tongoVersion , []abi.MethodInvocation {}, 24 * time .Hour )
493
493
if err != nil {
494
494
fmt .Println ("trace not saved: " , err )
495
495
}
@@ -522,11 +522,11 @@ func (h *Handler) EmulateMessageToTrace(ctx context.Context, request *oas.Emulat
522
522
if err != nil {
523
523
return nil , toError (http .StatusBadRequest , err )
524
524
}
525
- trace , _ , err = h .storage .GetTraceWithState (ctx , hs )
525
+ trace , version , _ , err : = h .storage .GetTraceWithState (ctx , hs )
526
526
if err != nil {
527
527
h .logger .Warn ("get trace from storage: " , zap .Error (err ))
528
528
}
529
- if trace == nil {
529
+ if trace == nil || h . tongoVersion == 0 || version > h . tongoVersion {
530
530
var m tlb.Message
531
531
err = tlb .Unmarshal (c , & m )
532
532
if err != nil {
@@ -556,7 +556,7 @@ func (h *Handler) EmulateMessageToTrace(ctx context.Context, request *oas.Emulat
556
556
if err != nil {
557
557
return nil , toError (http .StatusInternalServerError , err )
558
558
}
559
- err = h .storage .SaveTraceWithState (ctx , hs , trace , []abi.MethodInvocation {}, 24 * time .Hour )
559
+ err = h .storage .SaveTraceWithState (ctx , hs , trace , h . tongoVersion , []abi.MethodInvocation {}, 24 * time .Hour )
560
560
if err != nil {
561
561
fmt .Println ("trace not saved: " , err )
562
562
}
@@ -651,11 +651,11 @@ func (h *Handler) EmulateMessageToWallet(ctx context.Context, request *oas.Emula
651
651
if err != nil {
652
652
return nil , toError (http .StatusBadRequest , err )
653
653
}
654
- trace , _ , err := h .storage .GetTraceWithState (ctx , hash )
654
+ trace , version , _ , err := h .storage .GetTraceWithState (ctx , hash )
655
655
if err != nil {
656
656
h .logger .Warn ("get trace from storage: " , zap .Error (err ))
657
657
}
658
- if trace == nil {
658
+ if trace == nil || h . tongoVersion == 0 || version > h . tongoVersion {
659
659
configBase64 , err := h .storage .TrimmedConfigBase64 ()
660
660
if err != nil {
661
661
return nil , toError (http .StatusInternalServerError , err )
@@ -696,7 +696,7 @@ func (h *Handler) EmulateMessageToWallet(ctx context.Context, request *oas.Emula
696
696
if err != nil {
697
697
return nil , toError (http .StatusInternalServerError , err )
698
698
}
699
- err = h .storage .SaveTraceWithState (ctx , hash , trace , []abi.MethodInvocation {}, 24 * time .Hour )
699
+ err = h .storage .SaveTraceWithState (ctx , hash , trace , h . tongoVersion , []abi.MethodInvocation {}, 24 * time .Hour )
700
700
if err != nil {
701
701
fmt .Println ("trace not saved: " , err )
702
702
}
0 commit comments