Skip to content

Commit

Permalink
fix: break loop when exhausted all transactions
Browse files Browse the repository at this point in the history
  • Loading branch information
defi2026-dev committed Sep 28, 2024
1 parent b50926d commit f80aa60
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions ton/transactions.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@ import (
"context"
"errors"
"fmt"
"strings"
"time"

"github.com/xssnick/tonutils-go/address"
"github.com/xssnick/tonutils-go/tl"
"github.com/xssnick/tonutils-go/tlb"
"github.com/xssnick/tonutils-go/tvm/cell"
"strings"
"time"
)

func init() {
Expand Down Expand Up @@ -224,6 +225,11 @@ func (c *APIClient) SubscribeOnTransactions(workerCtx context.Context, addr *add
case <-time.After(waitList):
}

if lastLT == 0 {
// exhausted all transactins
break
}

ctx, cancel = context.WithTimeout(workerCtx, 10*time.Second)
res, err := c.ListTransactions(ctx, addr, 10, lastLT, lastHash)
cancel()
Expand Down

0 comments on commit f80aa60

Please sign in to comment.