Skip to content

Commit 0b51884

Browse files
committed
Require explicit channel type negotiation
This feature was introduced by lightning/bolts#880 We also clean up the channel state machine to leverage the feature bits added in #237
1 parent 19638a8 commit 0b51884

Some content is hidden

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

47 files changed

+2615
-550
lines changed

lightning-kmp-test-fixtures/src/commonMain/kotlin/fr/acinq/lightning/tests/TestConstants.kt

+9-13
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ object TestConstants {
3434

3535
object Alice {
3636
private val entropy = Hex.decode("0101010101010101010101010101010101010101010101010101010101010101")
37-
val mnemonics = MnemonicCode.toMnemonics(entropy)
38-
val seed = MnemonicCode.toSeed(mnemonics, "").toByteVector32()
37+
private val mnemonics = MnemonicCode.toMnemonics(entropy)
38+
private val seed = MnemonicCode.toSeed(mnemonics, "").toByteVector32()
3939

4040
val keyManager = LocalKeyManager(seed, Block.RegtestGenesisBlock.hash)
4141
val walletParams = WalletParams(NodeUri(randomKey().publicKey(), "alice.com", 9735), trampolineFees, InvoiceDefaultRoutingFees(1_000.msat, 100, CltvExpiryDelta(144)))
@@ -54,12 +54,10 @@ object TestConstants {
5454
Feature.StaticRemoteKey to FeatureSupport.Mandatory,
5555
Feature.AnchorOutputs to FeatureSupport.Mandatory,
5656
Feature.TrampolinePayment to FeatureSupport.Optional,
57-
Feature.ZeroReserveChannels to FeatureSupport.Optional,
58-
Feature.ZeroConfChannels to FeatureSupport.Optional,
59-
Feature.WakeUpNotificationClient to FeatureSupport.Optional,
60-
Feature.PayToOpenClient to FeatureSupport.Optional,
61-
Feature.TrustedSwapInClient to FeatureSupport.Optional,
62-
Feature.ChannelBackupClient to FeatureSupport.Optional,
57+
Feature.WakeUpNotificationProvider to FeatureSupport.Optional,
58+
Feature.PayToOpenProvider to FeatureSupport.Optional,
59+
Feature.TrustedSwapInProvider to FeatureSupport.Optional,
60+
Feature.ChannelBackupProvider to FeatureSupport.Optional,
6361
),
6462
dustLimit = 1_100.sat,
6563
maxRemoteDustLimit = 1_500.sat,
@@ -100,7 +98,7 @@ object TestConstants {
10098
enableTrampolinePayment = true
10199
)
102100

103-
val closingPubKeyInfo = keyManager.closingPubkeyScript(PublicKey.Generator)
101+
private val closingPubKeyInfo = keyManager.closingPubkeyScript(PublicKey.Generator)
104102
val channelParams: LocalParams = PeerChannels.makeChannelParams(
105103
nodeParams,
106104
defaultFinalScriptPubkey = ByteVector(closingPubKeyInfo.second),
@@ -112,7 +110,7 @@ object TestConstants {
112110
object Bob {
113111
private val entropy = Hex.decode("0202020202020202020202020202020202020202020202020202020202020202")
114112
val mnemonics = MnemonicCode.toMnemonics(entropy)
115-
val seed = MnemonicCode.toSeed(mnemonics, "").toByteVector32()
113+
private val seed = MnemonicCode.toSeed(mnemonics, "").toByteVector32()
116114
val keyManager = LocalKeyManager(seed, Block.RegtestGenesisBlock.hash)
117115
val walletParams = WalletParams(NodeUri(randomKey().publicKey(), "bob.com", 9735), trampolineFees, InvoiceDefaultRoutingFees(1_000.msat, 100, CltvExpiryDelta(144)))
118116
val nodeParams = NodeParams(
@@ -130,8 +128,6 @@ object TestConstants {
130128
Feature.StaticRemoteKey to FeatureSupport.Mandatory,
131129
Feature.AnchorOutputs to FeatureSupport.Mandatory,
132130
Feature.TrampolinePayment to FeatureSupport.Optional,
133-
Feature.ZeroReserveChannels to FeatureSupport.Optional,
134-
Feature.ZeroConfChannels to FeatureSupport.Optional,
135131
Feature.WakeUpNotificationClient to FeatureSupport.Optional,
136132
Feature.PayToOpenClient to FeatureSupport.Optional,
137133
Feature.TrustedSwapInClient to FeatureSupport.Optional,
@@ -176,7 +172,7 @@ object TestConstants {
176172
enableTrampolinePayment = true
177173
)
178174

179-
val closingPubKeyInfo = keyManager.closingPubkeyScript(PublicKey.Generator)
175+
private val closingPubKeyInfo = keyManager.closingPubkeyScript(PublicKey.Generator)
180176
val channelParams: LocalParams = PeerChannels.makeChannelParams(
181177
nodeParams,
182178
defaultFinalScriptPubkey = ByteVector(closingPubKeyInfo.second),

lightning-kmp-test-fixtures/src/commonMain/kotlin/fr/acinq/lightning/tests/io/peer/builders.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ public suspend fun CoroutineScope.newPeer(
136136
}
137137

138138
val yourLastPerCommitmentSecret = state.commitments.remotePerCommitmentSecrets.lastIndex?.let { state.commitments.remotePerCommitmentSecrets.getHash(it) } ?: ByteVector32.Zeroes
139-
val channelKeyPath = peer.nodeParams.keyManager.channelKeyPath(state.commitments.localParams, state.commitments.channelVersion)
139+
val channelKeyPath = peer.nodeParams.keyManager.channelKeyPath(state.commitments.localParams, state.commitments.channelConfig)
140140
val myCurrentPerCommitmentPoint = peer.nodeParams.keyManager.commitmentPoint(channelKeyPath, state.commitments.localCommit.index)
141141

142142
val channelReestablish = ChannelReestablish(

0 commit comments

Comments
 (0)