Skip to content

Commit e9c75ac

Browse files
committed
remove sone kludges for history
1 parent a0f9f5a commit e9c75ac

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

pkg/api/event_handlers.go

+2-7
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,6 @@ func (h *Handler) GetAccountEvents(ctx context.Context, params oas.GetAccountEve
219219
events := make([]oas.AccountEvent, 0, len(traceIDs))
220220

221221
var lastLT uint64
222-
var skippedInProgress []ton.Bits256
223222
for _, traceID := range traceIDs {
224223
lastLT = traceID.Lt
225224
trace, err := h.storage.GetTrace(ctx, traceID.Hash)
@@ -231,10 +230,6 @@ func (h *Handler) GetAccountEvents(ctx context.Context, params oas.GetAccountEve
231230
}
232231
continue
233232
}
234-
if trace.InProgress() {
235-
skippedInProgress = append(skippedInProgress, traceID.Hash)
236-
continue
237-
}
238233
actions, err := bath.FindActions(ctx, trace, bath.ForAccount(account.ID), bath.WithInformationSource(h.storage))
239234
if err != nil {
240235
events = append(events, h.toUnknownAccountEvent(account.ID, traceID))
@@ -250,7 +245,7 @@ func (h *Handler) GetAccountEvents(ctx context.Context, params oas.GetAccountEve
250245
}
251246
events = append(events, e)
252247
}
253-
if !(params.BeforeLt.IsSet() || params.StartDate.IsSet() || params.EndDate.IsSet()) { //if we look into history we don't need to mix mempool
248+
if !(params.BeforeLt.IsSet() || params.StartDate.IsSet() || params.EndDate.IsSet() || (len(events) > 0 && events[0].InProgress)) { //if we look into history we don't need to mix mempool
254249
memTraces, _ := h.mempoolEmulate.accountsTraces.Get(account.ID)
255250
i := 0
256251
for _, hash := range memTraces {
@@ -259,7 +254,7 @@ func (h *Handler) GetAccountEvents(ctx context.Context, params oas.GetAccountEve
259254
}
260255
tx, _ := h.storage.SearchTransactionByMessageHash(ctx, hash)
261256
trace, prs := h.mempoolEmulate.traces.Get(hash)
262-
if (tx != nil && !contains(skippedInProgress, *tx)) || !prs { //if err is nil it's already processed. If !prs we can't do anything
257+
if tx != nil || !prs { //if err is nil it's already processed. If !prs we can't do anything
263258
h.mempoolEmulate.traces.Delete(hash)
264259
continue
265260
}

0 commit comments

Comments
 (0)