File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed
app/src/main/java/to/bitkit/repositories Expand file tree Collapse file tree 1 file changed +14
-1
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
@@ -142,7 +143,13 @@ class BlocktankRepo @Inject constructor(
142143 )
143144 }
144145
145- Logger .debug(" Orders refreshed: ${orders.size} orders, ${cjitEntries.size} cjit entries" , context = TAG )
146+ Logger .debug(
147+ " Orders refreshed: ${orders.size} orders, " +
148+ " ${cjitEntries.size} cjit entries, " +
149+ " ${_blocktankState .value.paidOrders.size} paid orders" ,
150+ context = TAG
151+ )
152+ openChannelWithPaidOrders()
146153 } catch (e: Throwable ) {
147154 Logger .error(" Failed to refresh orders" , e, context = TAG )
148155 } finally {
@@ -284,6 +291,12 @@ class BlocktankRepo @Inject constructor(
284291 }
285292 }
286293
294+ private suspend fun openChannelWithPaidOrders () = withContext(bgDispatcher) {
295+ _blocktankState .value.paidOrders.filter { it.state2 == BtOrderState2 .PAID }.forEach { order ->
296+ openChannel(order.id)
297+ }
298+ }
299+
287300 private suspend fun defaultCreateOrderOptions (clientBalanceSat : ULong ): CreateOrderOptions {
288301 val nodeId = lightningService.nodeId ? : throw ServiceError .NodeNotStarted
289302 val timestamp = nowTimestamp().toString()
You can’t perform that action at this time.
0 commit comments