Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ android {
applicationId = "to.bitkit"
minSdk = 28
targetSdk = 36
versionCode = 179
versionName = "2.1.1"
versionCode = 180
versionName = "2.1.2"
testInstrumentationRunner = "to.bitkit.test.HiltTestRunner"
vectorDrawables {
useSupportLibrary = true
Expand Down
1 change: 1 addition & 0 deletions app/src/main/java/to/bitkit/env/Env.kt
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ internal object Env {
val network = Network.valueOf(BuildConfig.NETWORK)
val locales = BuildConfig.LOCALES.split(",")
const val walletSyncIntervalSecs = 10_uL
const val walletSyncTimeoutSecs = 10_uL
val platform = "Android ${Build.VERSION.RELEASE} (API ${Build.VERSION.SDK_INT})"
const val version = "$VERSION_NAME (${BuildConfig.VERSION_CODE})"

Expand Down
29 changes: 24 additions & 5 deletions app/src/main/java/to/bitkit/services/LightningService.kt
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ class LightningService @Inject constructor(
)
}

@Suppress("ForbiddenComment")
@Suppress("ForbiddenComment", "LongMethod")
private suspend fun build(
walletIndex: Int,
customServerUrl: String?,
Expand Down Expand Up @@ -186,11 +186,29 @@ class LightningService @Inject constructor(
"Building node with \n\t vssUrl: '$vssUrl'\n\t lnurlAuthServerUrl: '$lnurlAuthServerUrl'",
context = TAG,
)
if (lnurlAuthServerUrl.isNotEmpty()) {
builder.buildWithVssStore(vssUrl, vssStoreId, lnurlAuthServerUrl, fixedHeaders)
} else {
builder.buildWithVssStoreAndFixedHeaders(vssUrl, vssStoreId, fixedHeaders)

fun buildNode() = runCatching {
if (lnurlAuthServerUrl.isNotEmpty()) {
builder.buildWithVssStore(vssUrl, vssStoreId, lnurlAuthServerUrl, fixedHeaders)
} else {
builder.buildWithVssStoreAndFixedHeaders(vssUrl, vssStoreId, fixedHeaders)
}
}

buildNode().recoverCatching { error ->
if (error !is BuildException.DangerousValue) throw error
Logger.warn(
"Retrying build failed with 'DangerousValue' using 'setAcceptStaleChannelMonitors' for recovery.",
error,
context = TAG,
)
builder.setAcceptStaleChannelMonitors(true)
buildNode()
.onFailure {
Logger.error("Failed recovery retry using 'setAcceptStaleChannelMonitors'.", it, context = TAG)
}
.getOrThrow()
}.getOrThrow()
} catch (e: BuildException) {
throw LdkError(e)
} finally {
Expand Down Expand Up @@ -226,6 +244,7 @@ class LightningService @Inject constructor(
lightningWalletSyncIntervalSecs = Env.walletSyncIntervalSecs,
feeRateCacheUpdateIntervalSecs = Env.walletSyncIntervalSecs,
),
connectionTimeoutSecs = Env.walletSyncTimeoutSecs,
),
)
}
Expand Down
1 change: 1 addition & 0 deletions app/src/main/java/to/bitkit/utils/Errors.kt
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ class LdkError(private val inner: LdkException) : AppError("Unknown LDK error.")
is BuildException.InvalidAnnouncementAddresses -> "Invalid announcement addresses"
is BuildException.InvalidNodeAlias -> "Invalid node alias"
is BuildException.NetworkMismatch -> "Network mismatch"
is BuildException.DangerousValue -> "Dangerous value"
else -> exception.message
}?.let { "LDK Build error: $it" }
}
Expand Down
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ ktor-client-core = { module = "io.ktor:ktor-client-core", version.ref = "ktor" }
ktor-client-logging = { module = "io.ktor:ktor-client-logging", version.ref = "ktor" }
ktor-client-okhttp = { module = "io.ktor:ktor-client-okhttp", version.ref = "ktor" }
ktor-serialization-kotlinx-json = { module = "io.ktor:ktor-serialization-kotlinx-json", version.ref = "ktor" }
ldk-node-android = { module = "com.synonym:ldk-node-android", version = "0.7.0-rc.32" }
ldk-node-android = { module = "com.synonym:ldk-node-android", version = "0.7.0-rc.36" }
lifecycle-process = { group = "androidx.lifecycle", name = "lifecycle-process", version.ref = "lifecycle" }
lifecycle-runtime-compose = { module = "androidx.lifecycle:lifecycle-runtime-compose", version.ref = "lifecycle" }
lifecycle-runtime-ktx = { module = "androidx.lifecycle:lifecycle-runtime-ktx", version.ref = "lifecycle" }
Expand Down
Loading