From ddcf0462e656428fa71b7e5cdced79de76d47863 Mon Sep 17 00:00:00 2001 From: Andrey Pfau Date: Fri, 23 Dec 2022 22:26:52 +0300 Subject: [PATCH] add check for non-empty LiteServersDesc --- .../kotlin/org/ton/lite/client/LiteClient.kt | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/ton-kotlin-liteclient/src/commonMain/kotlin/org/ton/lite/client/LiteClient.kt b/ton-kotlin-liteclient/src/commonMain/kotlin/org/ton/lite/client/LiteClient.kt index 04d3099d..11a6aa24 100644 --- a/ton-kotlin-liteclient/src/commonMain/kotlin/org/ton/lite/client/LiteClient.kt +++ b/ton-kotlin-liteclient/src/commonMain/kotlin/org/ton/lite/client/LiteClient.kt @@ -36,6 +36,20 @@ public class LiteClient( coroutineContext: CoroutineContext, private val liteClientConfigGlobal: LiteClientConfigGlobal ) : Closeable, CoroutineScope { + public constructor( + coroutineContext: CoroutineContext, + liteServers: List + ) : this(coroutineContext, LiteClientConfigGlobal(liteServers = liteServers)) + + public constructor( + coroutineContext: CoroutineContext, + vararg liteServer: LiteServerDesc + ) : this(coroutineContext, liteServer.toList()) + + init { + require(liteClientConfigGlobal.liteServers.isNotEmpty()) { "No lite servers provided" } + } + private val logger: Logger = PrintLnLogger("LiteClient") override val coroutineContext: CoroutineContext = coroutineContext + CoroutineName("LiteClient") private val knownBlockIds: ArrayDeque = ArrayDeque(100)