Skip to content

Commit d067b1f

Browse files
authored
Remove optional InitTlv override in Peer (#766)
Also removed `PhoenixAndroidLegacyNodeId`. This was needed for backward compat with old Android wallets.
1 parent 47987a4 commit d067b1f

File tree

4 files changed

+2
-71
lines changed

4 files changed

+2
-71
lines changed

modules/core/src/commonMain/kotlin/fr/acinq/lightning/io/Peer.kt

+2-4
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,6 @@ data class AddressAssigned(val address: String) : PeerEvent()
173173
* @param watcher Watches events from the Electrum client and publishes transactions and events.
174174
* @param db Wraps the various databases persisting the channels and payments data related to the Peer.
175175
* @param socketBuilder Builds the TCP socket used to connect to the Peer.
176-
* @param initTlvStream Optional stream of TLV for the [Init] message we send to this Peer after connection. Empty by default.
177176
*/
178177
@OptIn(ExperimentalStdlibApi::class)
179178
class Peer(
@@ -183,8 +182,7 @@ class Peer(
183182
val watcher: IWatcher,
184183
val db: Databases,
185184
socketBuilder: TcpSocket.Builder?,
186-
scope: CoroutineScope,
187-
private val initTlvStream: TlvStream<InitTlv> = TlvStream.empty()
185+
scope: CoroutineScope
188186
) : CoroutineScope by scope {
189187
companion object {
190188
private const val prefix: Byte = 0x00
@@ -235,7 +233,7 @@ class Peer(
235233

236234
private val features = nodeParams.features
237235

238-
private val ourInit = Init(features.initFeatures(), initTlvStream)
236+
private val ourInit = Init(features.initFeatures())
239237
private var theirInit: Init? = null
240238

241239
val currentTipFlow = MutableStateFlow<Int?>(null)

modules/core/src/commonMain/kotlin/fr/acinq/lightning/wire/InitTlv.kt

-21
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
package fr.acinq.lightning.wire
22

33
import fr.acinq.bitcoin.ByteVector32
4-
import fr.acinq.bitcoin.ByteVector64
5-
import fr.acinq.bitcoin.PublicKey
64
import fr.acinq.bitcoin.io.Input
75
import fr.acinq.bitcoin.io.Output
86

@@ -42,23 +40,4 @@ sealed class InitTlv : Tlv {
4240
override fun read(input: Input): OptionWillFund = OptionWillFund(LiquidityAds.WillFundRates.read(input))
4341
}
4442
}
45-
46-
data class PhoenixAndroidLegacyNodeId(val legacyNodeId: PublicKey, val signature: ByteVector64) : InitTlv() {
47-
override val tag: Long get() = PhoenixAndroidLegacyNodeId.tag
48-
49-
override fun write(out: Output) {
50-
LightningCodecs.writeBytes(legacyNodeId.value, out)
51-
LightningCodecs.writeBytes(signature, out)
52-
}
53-
54-
companion object : TlvValueReader<PhoenixAndroidLegacyNodeId> {
55-
const val tag: Long = 0x47020001
56-
57-
override fun read(input: Input): PhoenixAndroidLegacyNodeId {
58-
val legacyNodeId = PublicKey(LightningCodecs.bytes(input, 33))
59-
val signature = ByteVector64(LightningCodecs.bytes(input, 64))
60-
return PhoenixAndroidLegacyNodeId(legacyNodeId, signature)
61-
}
62-
}
63-
}
6443
}

modules/core/src/commonMain/kotlin/fr/acinq/lightning/wire/LightningMessages.kt

-1
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,6 @@ data class Init(val features: Features, val tlvs: TlvStream<InitTlv> = TlvStream
223223
val readers = mapOf(
224224
InitTlv.Networks.tag to InitTlv.Networks.Companion as TlvValueReader<InitTlv>,
225225
InitTlv.OptionWillFund.tag to InitTlv.OptionWillFund.Companion as TlvValueReader<InitTlv>,
226-
InitTlv.PhoenixAndroidLegacyNodeId.tag to InitTlv.PhoenixAndroidLegacyNodeId.Companion as TlvValueReader<InitTlv>,
227226
)
228227

229228
override fun read(input: Input): Init {

modules/core/src/commonTest/kotlin/fr/acinq/lightning/wire/InitTlvTestsCommon.kt

-45
This file was deleted.

0 commit comments

Comments
 (0)