File tree Expand file tree Collapse file tree 1 file changed +8
-0
lines changed
app/src/main/java/to/bitkit/repositories Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change 11package to.bitkit.repositories
22
3+ import com.synonym.bitkitcore.BtOrderState2
34import com.synonym.bitkitcore.CreateCjitOptions
45import com.synonym.bitkitcore.CreateOrderOptions
56import com.synonym.bitkitcore.IBtEstimateFeeResponse2
@@ -146,6 +147,7 @@ class BlocktankRepo @Inject constructor(
146147 " Orders refreshed: ${orders.size} orders, ${cjitEntries.size} cjit entries" ,
147148 context = TAG
148149 )
150+ openChannelWithPaidOrders()
149151 } catch (e: Throwable ) {
150152 Logger .error(" Failed to refresh orders" , e, context = TAG )
151153 } finally {
@@ -287,6 +289,12 @@ class BlocktankRepo @Inject constructor(
287289 }
288290 }
289291
292+ private suspend fun openChannelWithPaidOrders () = withContext(bgDispatcher) {
293+ _blocktankState .value.paidOrders.filter { it.state2 == BtOrderState2 .PAID }.forEach { order ->
294+ openChannel(order.id)
295+ }
296+ }
297+
290298 private suspend fun defaultCreateOrderOptions (clientBalanceSat : ULong ): CreateOrderOptions {
291299 val nodeId = lightningService.nodeId ? : throw ServiceError .NodeNotStarted
292300 val timestamp = nowTimestamp().toString()
You can’t perform that action at this time.
0 commit comments