Skip to content

Commit d9522d0

Browse files
committed
Remove deprecated serialization format and fields
The v4 serialization format was released in July 2023 with better support for backwards-compatibility: the v2 and v3 formats used kotlin's serialization, which prevents us from removing legacy classes and requires additional code whenever we change something in the channel state. Users who haven't migrated their data to the v4 format will not be able to deserialize their channel data: they will need to use a previous version of the app to read their old channel data, write it to the v4 format and then upgrade to the latest version. We also remove a bunch of fields/options that were deprecated a while ago: - legacy channel funding states - unused legacy features - legacy private key generation - legacy node events
1 parent 1222f8e commit d9522d0

File tree

133 files changed

+2126
-12615
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

133 files changed

+2126
-12615
lines changed

modules/core/src/commonMain/kotlin/fr/acinq/lightning/Features.kt

Lines changed: 0 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -147,17 +147,6 @@ sealed class Feature {
147147
override val scopes: Set<FeatureScope> get() = setOf(FeatureScope.Invoice)
148148
}
149149

150-
// We historically used the following feature bit in our invoices.
151-
// However, the spec assigned the same feature bit to `option_scid_alias` (https://github.com/lightning/bolts/pull/910).
152-
// We're moving this feature bit to 148, but we have to keep supporting it until enough wallet users have migrated, then we can remove it.
153-
// We cannot rename that object otherwise we will not be able to read old serialized data.
154-
@Serializable
155-
object TrampolinePayment : Feature() {
156-
override val rfcName get() = "trampoline_payment_backwards_compat"
157-
override val mandatory get() = 50
158-
override val scopes: Set<FeatureScope> get() = setOf(FeatureScope.Init, FeatureScope.Node, FeatureScope.Invoice)
159-
}
160-
161150
@Serializable
162151
object SimpleClose : Feature() {
163152
override val rfcName get() = "option_simple_close"
@@ -175,14 +164,6 @@ sealed class Feature {
175164
override val scopes: Set<FeatureScope> get() = setOf(FeatureScope.Init, FeatureScope.Node)
176165
}
177166

178-
/** DEPRECATED: this feature bit should not be used, it is only kept for serialization backwards-compatibility. */
179-
@Serializable
180-
object ZeroConfChannels : Feature() {
181-
override val rfcName get() = "zero_conf_channels"
182-
override val mandatory get() = 130
183-
override val scopes: Set<FeatureScope> get() = setOf(FeatureScope.Init, FeatureScope.Node)
184-
}
185-
186167
/** This feature bit should be activated when a mobile node supports waking up via push notifications. */
187168
@Serializable
188169
object WakeUpNotificationClient : Feature() {
@@ -199,38 +180,6 @@ sealed class Feature {
199180
override val scopes: Set<FeatureScope> get() = setOf(FeatureScope.Init, FeatureScope.Node)
200181
}
201182

202-
/** DEPRECATED: this feature bit was used for the legacy pay-to-open protocol. */
203-
@Serializable
204-
object PayToOpenClient : Feature() {
205-
override val rfcName get() = "pay_to_open_client"
206-
override val mandatory get() = 136
207-
override val scopes: Set<FeatureScope> get() = setOf(FeatureScope.Init)
208-
}
209-
210-
/** DEPRECATED: this feature bit was used for the legacy pay-to-open protocol. */
211-
@Serializable
212-
object PayToOpenProvider : Feature() {
213-
override val rfcName get() = "pay_to_open_provider"
214-
override val mandatory get() = 138
215-
override val scopes: Set<FeatureScope> get() = setOf(FeatureScope.Init, FeatureScope.Node)
216-
}
217-
218-
/** DEPRECATED: this feature bit should not be used, it is only kept for serialization backwards-compatibility. */
219-
@Serializable
220-
object TrustedSwapInClient : Feature() {
221-
override val rfcName get() = "trusted_swap_in_client"
222-
override val mandatory get() = 140
223-
override val scopes: Set<FeatureScope> get() = setOf(FeatureScope.Init)
224-
}
225-
226-
/** DEPRECATED: this feature bit should not be used, it is only kept for serialization backwards-compatibility. */
227-
@Serializable
228-
object TrustedSwapInProvider : Feature() {
229-
override val rfcName get() = "trusted_swap_in_provider"
230-
override val mandatory get() = 142
231-
override val scopes: Set<FeatureScope> get() = setOf(FeatureScope.Init, FeatureScope.Node)
232-
}
233-
234183
/** This feature bit should be activated when a node wants to send channel backups to their peers. */
235184
@Serializable
236185
object ChannelBackupClient : Feature() {
@@ -346,17 +295,11 @@ data class Features(val activated: Map<Feature, FeatureSupport>, val unknown: Se
346295
Feature.Quiescence,
347296
Feature.ChannelType,
348297
Feature.PaymentMetadata,
349-
Feature.TrampolinePayment,
350298
Feature.SimpleClose,
351299
Feature.ExperimentalTrampolinePayment,
352300
Feature.ZeroReserveChannels,
353-
Feature.ZeroConfChannels,
354301
Feature.WakeUpNotificationClient,
355302
Feature.WakeUpNotificationProvider,
356-
Feature.PayToOpenClient,
357-
Feature.PayToOpenProvider,
358-
Feature.TrustedSwapInClient,
359-
Feature.TrustedSwapInProvider,
360303
Feature.ChannelBackupClient,
361304
Feature.ChannelBackupProvider,
362305
Feature.ExperimentalSplice,
@@ -393,7 +336,6 @@ data class Features(val activated: Map<Feature, FeatureSupport>, val unknown: Se
393336
Feature.BasicMultiPartPayment to listOf(Feature.PaymentSecret),
394337
Feature.AnchorOutputs to listOf(Feature.StaticRemoteKey),
395338
Feature.SimpleClose to listOf(Feature.ShutdownAnySegwit),
396-
Feature.TrampolinePayment to listOf(Feature.PaymentSecret),
397339
Feature.ExperimentalTrampolinePayment to listOf(Feature.PaymentSecret),
398340
Feature.OnTheFlyFunding to listOf(Feature.ExperimentalSplice),
399341
Feature.FundingFeeCredit to listOf(Feature.OnTheFlyFunding)

modules/core/src/commonMain/kotlin/fr/acinq/lightning/NodeParams.kt

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -176,11 +176,6 @@ data class NodeParams(
176176
require(features.hasFeature(Feature.RouteBlinding)) { "${Feature.RouteBlinding.rfcName} should be supported" }
177177
require(features.hasFeature(Feature.ShutdownAnySegwit, FeatureSupport.Mandatory)) { "${Feature.ShutdownAnySegwit.rfcName} should be mandatory" }
178178
require(features.hasFeature(Feature.SimpleClose, FeatureSupport.Mandatory)) { "${Feature.SimpleClose.rfcName} should be mandatory" }
179-
require(!features.hasFeature(Feature.ZeroConfChannels)) { "${Feature.ZeroConfChannels.rfcName} has been deprecated: use the zeroConfPeers whitelist instead" }
180-
require(!features.hasFeature(Feature.TrustedSwapInClient)) { "${Feature.TrustedSwapInClient.rfcName} has been deprecated" }
181-
require(!features.hasFeature(Feature.TrustedSwapInProvider)) { "${Feature.TrustedSwapInProvider.rfcName} has been deprecated" }
182-
require(!features.hasFeature(Feature.PayToOpenClient)) { "${Feature.PayToOpenClient.rfcName} has been deprecated" }
183-
require(!features.hasFeature(Feature.PayToOpenProvider)) { "${Feature.PayToOpenProvider.rfcName} has been deprecated" }
184179
Features.validateFeatureGraph(features)
185180
// Verify expiry parameters are consistent with each other.
186181
require((fulfillSafetyBeforeTimeoutBlocks * 2) < minFinalCltvExpiryDelta) { "min_final_expiry_delta must be at least twice as long as fulfill_safety_before_timeout_blocks" }

modules/core/src/commonMain/kotlin/fr/acinq/lightning/channel/states/Channel.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -257,8 +257,6 @@ sealed class ChannelState {
257257
is Offline -> state.run { handleLocalError(cmd, t) }
258258
is Syncing -> state.run { handleLocalError(cmd, t) }
259259
is WaitForRemotePublishFutureCommitment -> Pair(state, emptyList())
260-
is LegacyWaitForFundingConfirmed -> forceClose(state)
261-
is LegacyWaitForFundingLocked -> forceClose(state)
262260
}
263261
}
264262

modules/core/src/commonMain/kotlin/fr/acinq/lightning/channel/states/LegacyWaitForFundingConfirmed.kt

Lines changed: 0 additions & 88 deletions
This file was deleted.

modules/core/src/commonMain/kotlin/fr/acinq/lightning/channel/states/LegacyWaitForFundingLocked.kt

Lines changed: 0 additions & 83 deletions
This file was deleted.

modules/core/src/commonMain/kotlin/fr/acinq/lightning/channel/states/Syncing.kt

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,6 @@ data class Syncing(val state: PersistedChannelState, val channelReestablishSent:
2525
is ChannelCommand.MessageReceived -> when (cmd.message) {
2626
is ChannelReestablish -> {
2727
val (nextState, actions) = when (state) {
28-
is LegacyWaitForFundingConfirmed -> {
29-
Pair(state, listOf())
30-
}
3128
is WaitForFundingSigned -> {
3229
when (cmd.message.nextFundingTxId) {
3330
// We retransmit our commit_sig, and will send our tx_signatures once we've received their commit_sig.
@@ -109,13 +106,6 @@ data class Syncing(val state: PersistedChannelState, val channelReestablishSent:
109106

110107
Pair(state, actions)
111108
}
112-
is LegacyWaitForFundingLocked -> {
113-
logger.debug { "re-sending channel_ready" }
114-
val nextPerCommitmentPoint = channelKeys().commitmentPoint(1)
115-
val channelReady = ChannelReady(state.commitments.channelId, nextPerCommitmentPoint)
116-
val actions = listOf(ChannelAction.Message.Send(channelReady))
117-
Pair(state, actions)
118-
}
119109
is Normal -> {
120110
when (val syncResult = handleSync(state.commitments, cmd.message)) {
121111
is SyncResult.Failure -> handleSyncFailure(state.commitments, cmd.message, syncResult)

modules/core/src/commonMain/kotlin/fr/acinq/lightning/crypto/KeyManager.kt

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,7 @@ interface KeyManager {
4141
* Keys used for the node. They are used to generate the node id, to secure communication with other peers, and
4242
* to sign network-wide public announcements.
4343
*/
44-
data class NodeKeys(
45-
/** The node key that the same seed would have produced on the legacy eclair-based Phoenix implementation on Android. Useful to automate the migration. */
46-
val legacyNodeKey: DeterministicWallet.ExtendedPrivateKey,
47-
val nodeKey: DeterministicWallet.ExtendedPrivateKey,
48-
)
44+
data class NodeKeys(val nodeKey: DeterministicWallet.ExtendedPrivateKey)
4945

5046
/**
5147
* Secrets and keys for a given channel.

0 commit comments

Comments
 (0)