File tree Expand file tree Collapse file tree 1 file changed +7
-0
lines changed
app/src/main/java/to/bitkit/repositories Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -33,6 +33,7 @@ import kotlinx.coroutines.flow.update
3333import kotlinx.coroutines.isActive
3434import kotlinx.coroutines.launch
3535import kotlinx.coroutines.withContext
36+ import kotlinx.coroutines.withTimeout
3637import org.lightningdevkit.ldknode.ChannelDetails
3738import to.bitkit.async.ServiceQueue
3839import to.bitkit.data.CacheStore
@@ -52,6 +53,7 @@ import javax.inject.Named
5253import javax.inject.Singleton
5354import kotlin.math.ceil
5455import kotlin.time.Duration
56+ import kotlin.time.Duration.Companion.minutes
5557import kotlin.time.Duration.Companion.seconds
5658
5759@Singleton
@@ -282,6 +284,11 @@ class BlocktankRepo @Inject constructor(
282284 suspend fun openChannel (orderId : String ): Result <IBtOrder > = withContext(bgDispatcher) {
283285 try {
284286 Logger .debug(" Opening channel for order: '$orderId '" , context = TAG )
287+
288+ withTimeout(1 .minutes) {
289+ lightningRepo.lightningState.first { it.nodeStatus?.isRunning ? : false }
290+ }
291+
285292 val order = coreService.blocktank.open(orderId)
286293
287294 // Update the order in state
You can’t perform that action at this time.
0 commit comments