Skip to content

Commit

Permalink
Merge pull request #149 from xssnick/dev-v186
Browse files Browse the repository at this point in the history
Fixed panic in SubscribeOnTransactions method
  • Loading branch information
xssnick authored Nov 29, 2023
2 parents a7f4ad3 + 6eeee92 commit 6f038ab
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 6f038ab

Please sign in to comment.