Skip to content

Commit

Permalink
Dont inspect account twice in API methods for emulation
Browse files Browse the repository at this point in the history
(cherry picked from commit 2054c3e)
  • Loading branch information
aleksej-paschenko authored and mr-tron committed Oct 13, 2023
1 parent d6fae81 commit f83d018
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions pkg/api/event_handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -595,6 +595,7 @@ func emulatedTreeToTrace(ctx context.Context, resolver core.LibraryResolver, con
Token1: *t1,
}
}
// TODO: find out masters of t0, t1
}
}
return t, nil
Expand Down
14 changes: 14 additions & 0 deletions pkg/core/trace.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,13 @@ func CollectAdditionalInfo(ctx context.Context, infoSource InformationSource, tr
var basicNftSale []tongo.AccountID
var stonfiPoolIDs []tongo.AccountID
visit(trace, func(trace *Trace) {
// when we emulate a trace,
// we construct "trace.AdditionalInfo" in emulatedTreeToTrace for all accounts the trace touches.
// moreover, some accounts change their states and some of them are not exist in the blockchain,
// so we must not inspect them again.
if trace.AdditionalInfo != nil {
return
}
if isDestinationJettonWallet(trace.InMsg) {
jettonWallets = append(jettonWallets, *trace.InMsg.Destination)
}
Expand Down Expand Up @@ -135,6 +142,13 @@ func CollectAdditionalInfo(ctx context.Context, infoSource InformationSource, tr
return err
}
visit(trace, func(trace *Trace) {
// when we emulate a trace,
// we construct "trace.AdditionalInfo" in emulatedTreeToTrace for all accounts the trace touches.
// moreover, some accounts change their states and some of them are not exist in the blockchain,
// so we must not inspect them again.
if trace.AdditionalInfo != nil {
return
}
trace.AdditionalInfo = &TraceAdditionalInfo{}
if isDestinationJettonWallet(trace.InMsg) {
if master, ok := masters[*trace.InMsg.Destination]; ok {
Expand Down

0 comments on commit f83d018

Please sign in to comment.