Skip to content

Commit f257824

Browse files
authored
Merge pull request #859 from synonymdev/release-2.1.2
chore: version 2.1.2
2 parents 1df7515 + 5e71129 commit f257824

5 files changed

Lines changed: 29 additions & 8 deletions

File tree

app/build.gradle.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ android {
5555
applicationId = "to.bitkit"
5656
minSdk = 28
5757
targetSdk = 36
58-
versionCode = 179
59-
versionName = "2.1.1"
58+
versionCode = 180
59+
versionName = "2.1.2"
6060
testInstrumentationRunner = "to.bitkit.test.HiltTestRunner"
6161
vectorDrawables {
6262
useSupportLibrary = true

app/src/main/java/to/bitkit/env/Env.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ internal object Env {
2323
val network = Network.valueOf(BuildConfig.NETWORK)
2424
val locales = BuildConfig.LOCALES.split(",")
2525
const val walletSyncIntervalSecs = 10_uL
26+
const val walletSyncTimeoutSecs = 10_uL
2627
val platform = "Android ${Build.VERSION.RELEASE} (API ${Build.VERSION.SDK_INT})"
2728
const val version = "$VERSION_NAME (${BuildConfig.VERSION_CODE})"
2829

app/src/main/java/to/bitkit/services/LightningService.kt

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ class LightningService @Inject constructor(
138138
)
139139
}
140140

141-
@Suppress("ForbiddenComment")
141+
@Suppress("ForbiddenComment", "LongMethod")
142142
private suspend fun build(
143143
walletIndex: Int,
144144
customServerUrl: String?,
@@ -186,11 +186,29 @@ class LightningService @Inject constructor(
186186
"Building node with \n\t vssUrl: '$vssUrl'\n\t lnurlAuthServerUrl: '$lnurlAuthServerUrl'",
187187
context = TAG,
188188
)
189-
if (lnurlAuthServerUrl.isNotEmpty()) {
190-
builder.buildWithVssStore(vssUrl, vssStoreId, lnurlAuthServerUrl, fixedHeaders)
191-
} else {
192-
builder.buildWithVssStoreAndFixedHeaders(vssUrl, vssStoreId, fixedHeaders)
189+
190+
fun buildNode() = runCatching {
191+
if (lnurlAuthServerUrl.isNotEmpty()) {
192+
builder.buildWithVssStore(vssUrl, vssStoreId, lnurlAuthServerUrl, fixedHeaders)
193+
} else {
194+
builder.buildWithVssStoreAndFixedHeaders(vssUrl, vssStoreId, fixedHeaders)
195+
}
193196
}
197+
198+
buildNode().recoverCatching { error ->
199+
if (error !is BuildException.DangerousValue) throw error
200+
Logger.warn(
201+
"Retrying build failed with 'DangerousValue' using 'setAcceptStaleChannelMonitors' for recovery.",
202+
error,
203+
context = TAG,
204+
)
205+
builder.setAcceptStaleChannelMonitors(true)
206+
buildNode()
207+
.onFailure {
208+
Logger.error("Failed recovery retry using 'setAcceptStaleChannelMonitors'.", it, context = TAG)
209+
}
210+
.getOrThrow()
211+
}.getOrThrow()
194212
} catch (e: BuildException) {
195213
throw LdkError(e)
196214
} finally {
@@ -226,6 +244,7 @@ class LightningService @Inject constructor(
226244
lightningWalletSyncIntervalSecs = Env.walletSyncIntervalSecs,
227245
feeRateCacheUpdateIntervalSecs = Env.walletSyncIntervalSecs,
228246
),
247+
connectionTimeoutSecs = Env.walletSyncTimeoutSecs,
229248
),
230249
)
231250
}

app/src/main/java/to/bitkit/utils/Errors.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ class LdkError(private val inner: LdkException) : AppError("Unknown LDK error.")
4949
is BuildException.InvalidAnnouncementAddresses -> "Invalid announcement addresses"
5050
is BuildException.InvalidNodeAlias -> "Invalid node alias"
5151
is BuildException.NetworkMismatch -> "Network mismatch"
52+
is BuildException.DangerousValue -> "Dangerous value"
5253
else -> exception.message
5354
}?.let { "LDK Build error: $it" }
5455
}

gradle/libs.versions.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ ktor-client-core = { module = "io.ktor:ktor-client-core", version.ref = "ktor" }
5959
ktor-client-logging = { module = "io.ktor:ktor-client-logging", version.ref = "ktor" }
6060
ktor-client-okhttp = { module = "io.ktor:ktor-client-okhttp", version.ref = "ktor" }
6161
ktor-serialization-kotlinx-json = { module = "io.ktor:ktor-serialization-kotlinx-json", version.ref = "ktor" }
62-
ldk-node-android = { module = "com.synonym:ldk-node-android", version = "0.7.0-rc.32" }
62+
ldk-node-android = { module = "com.synonym:ldk-node-android", version = "0.7.0-rc.36" }
6363
lifecycle-process = { group = "androidx.lifecycle", name = "lifecycle-process", version.ref = "lifecycle" }
6464
lifecycle-runtime-compose = { module = "androidx.lifecycle:lifecycle-runtime-compose", version.ref = "lifecycle" }
6565
lifecycle-runtime-ktx = { module = "androidx.lifecycle:lifecycle-runtime-ktx", version.ref = "lifecycle" }

0 commit comments

Comments
 (0)