Skip to content

Commit

Permalink
Fixed panic in SubscribeOnTransactions method
Browse files Browse the repository at this point in the history
  • Loading branch information
pr0n1x committed Nov 28, 2023
1 parent a7f4ad3 commit 340ef7f
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions ton/transactions.go
Original file line number Diff line number Diff line change
Expand Up @@ -250,18 +250,18 @@ func (c *APIClient) SubscribeOnTransactions(workerCtx context.Context, addr *add
transactions = append(transactions, res...)
waitList = 0 * time.Second
}
lastProcessedLT = transactions[0].LT // mark last transaction as known to not trigger twice
if len(transactions) > 0 {
lastProcessedLT = transactions[0].LT // mark last transaction as known to not trigger twice

// reverse slice to send in correct time order (from old to new)
for i, j := 0, len(transactions)-1; i < j; i, j = i+1, j-1 {
transactions[i], transactions[j] = transactions[j], transactions[i]
}
// reverse slice to send in correct time order (from old to new)
for i, j := 0, len(transactions)-1; i < j; i, j = i+1, j-1 {
transactions[i], transactions[j] = transactions[j], transactions[i]
}

for _, tx := range transactions {
channel <- tx
}
for _, tx := range transactions {
channel <- tx
}

if len(transactions) > 0 {
wait = 0 * time.Second
}
}
Expand Down

0 comments on commit 340ef7f

Please sign in to comment.