Skip to content

Commit ddcf046

Browse files
committed
add check for non-empty LiteServersDesc
1 parent 6d960b9 commit ddcf046

File tree

1 file changed

+14
-0
lines changed
  • ton-kotlin-liteclient/src/commonMain/kotlin/org/ton/lite/client

1 file changed

+14
-0
lines changed

ton-kotlin-liteclient/src/commonMain/kotlin/org/ton/lite/client/LiteClient.kt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,20 @@ public class LiteClient(
3636
coroutineContext: CoroutineContext,
3737
private val liteClientConfigGlobal: LiteClientConfigGlobal
3838
) : Closeable, CoroutineScope {
39+
public constructor(
40+
coroutineContext: CoroutineContext,
41+
liteServers: List<LiteServerDesc>
42+
) : this(coroutineContext, LiteClientConfigGlobal(liteServers = liteServers))
43+
44+
public constructor(
45+
coroutineContext: CoroutineContext,
46+
vararg liteServer: LiteServerDesc
47+
) : this(coroutineContext, liteServer.toList())
48+
49+
init {
50+
require(liteClientConfigGlobal.liteServers.isNotEmpty()) { "No lite servers provided" }
51+
}
52+
3953
private val logger: Logger = PrintLnLogger("LiteClient")
4054
override val coroutineContext: CoroutineContext = coroutineContext + CoroutineName("LiteClient")
4155
private val knownBlockIds: ArrayDeque<TonNodeBlockIdExt> = ArrayDeque(100)

0 commit comments

Comments
 (0)