Skip to content

Commit

Permalink
Merge pull request #265 from defi2026-dev/master
Browse files Browse the repository at this point in the history
fix: break loop when exhausted all transactions
  • Loading branch information
xssnick authored Nov 21, 2024
2 parents a0eeb51 + 72f37fe commit c1df7b5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ You could also join our **[Telegram channel](https://t.me/tonutilsnews)** and **
You can use liteservers from TON configs:
* Mainnet public servers - `https://ton.org/global.config.json`
* Testnet public servers - `https://ton-blockchain.github.io/testnet-global.config.json`
* Mainnet servers by Tonutils - `https://tonutils.com/ls/free-mainnet-config.json`

from liteservers section, you need to convert int to ip and take port and key.

Expand Down
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 transactions
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 c1df7b5

Please sign in to comment.