neodix42 / ton4j

Java libraries for interacting with TON blockchain.
GNU General Public License v3.0
76 stars 27 forks source link

Error "lite-server cannot return any transactions", reconnect to lite server #29

Closed SaitgalinKhannan closed 3 months ago

SaitgalinKhannan commented 3 months ago

if (isNull(rawTransactions.getTransactions())) { throw new Error("lite-server cannot return any transactions"); }

Why is there an Error here instead of a custom Exception? I wanted to catch an Exception and implement reconnection to another lite server.

Is it generally possible to implement reconnection to another lite server when there's no account data and transactions in the current one? (I want to try to do this, but I'm not sure if it's possible at the library level)

neodix42 commented 3 months ago

You still can catch it with catch Error or Throwable. Yes it is possible to write a custom reconnection mechanism. I also plan to add a flag to tonlib builder so tonlib could iterate automatically through a list of lite-servers.

neodix42 commented 3 months ago

please check the new version https://github.com/neodix42/ton4j/releases/tag/0.5.0 where reconnection has been implemented.

SaitgalinKhannan commented 3 months ago

It`s work, thanks