Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement simple taproot channels #679

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft
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
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
group=fr.acinq.lightning
version=1.8.5-SNAPSHOT
version=1.8.5-TAPROOT-SNAPSHOT
# gradle
org.gradle.jvmargs=-Xmx1536m
org.gradle.parallel=true
Expand Down
12 changes: 10 additions & 2 deletions modules/core/src/commonMain/kotlin/fr/acinq/lightning/Features.kt
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,12 @@ sealed class Feature {
override val scopes: Set<FeatureScope> get() = setOf(FeatureScope.Init, FeatureScope.Node)
}

@Serializable
object SimpleTaprootStaging : Feature() {
override val rfcName get() = "option_simple_taproot_staging"
override val mandatory get() = 182 // README: this is not the feature bit defined in the bolt proposal (180) because we don't support zero-fee anchor outputs
override val scopes: Set<FeatureScope> get() = setOf(FeatureScope.Init, FeatureScope.Node)
}
}

@Serializable
Expand Down Expand Up @@ -353,7 +359,8 @@ data class Features(val activated: Map<Feature, FeatureSupport>, val unknown: Se
Feature.ChannelBackupProvider,
Feature.ExperimentalSplice,
Feature.OnTheFlyFunding,
Feature.FundingFeeCredit
Feature.FundingFeeCredit,
Feature.SimpleTaprootStaging
)

operator fun invoke(bytes: ByteVector): Features = invoke(bytes.toByteArray())
Expand Down Expand Up @@ -387,7 +394,8 @@ data class Features(val activated: Map<Feature, FeatureSupport>, val unknown: Se
Feature.TrampolinePayment to listOf(Feature.PaymentSecret),
Feature.ExperimentalTrampolinePayment to listOf(Feature.PaymentSecret),
Feature.OnTheFlyFunding to listOf(Feature.ExperimentalSplice),
Feature.FundingFeeCredit to listOf(Feature.OnTheFlyFunding)
Feature.FundingFeeCredit to listOf(Feature.OnTheFlyFunding),
Feature.SimpleTaprootStaging to listOf(Feature.StaticRemoteKey)
)

class FeatureException(message: String) : IllegalArgumentException(message)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ data class NodeParams(
Feature.ExperimentalSplice to FeatureSupport.Optional,
Feature.OnTheFlyFunding to FeatureSupport.Optional,
Feature.FundingFeeCredit to FeatureSupport.Optional,
Feature.SimpleTaprootStaging to FeatureSupport.Optional,
),
dustLimit = 546.sat,
maxRemoteDustLimit = 600.sat,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ data class InvalidPushAmount (override val channelId: Byte
data class InvalidMaxAcceptedHtlcs (override val channelId: ByteVector32, val maxAcceptedHtlcs: Int, val max: Int) : ChannelException(channelId, "invalid max_accepted_htlcs=$maxAcceptedHtlcs (max=$max)")
data class InvalidChannelType (override val channelId: ByteVector32, val ourChannelType: ChannelType, val theirChannelType: ChannelType) : ChannelException(channelId, "invalid channel_type=${theirChannelType.name}, expected channel_type=${ourChannelType.name}")
data class MissingChannelType (override val channelId: ByteVector32) : ChannelException(channelId, "option_channel_type was negotiated but channel_type is missing")
data class MissingNextLocalNonces (override val channelId: ByteVector32) : ChannelException(channelId, "missing next local nonces")
data class DustLimitTooSmall (override val channelId: ByteVector32, val dustLimit: Satoshi, val min: Satoshi) : ChannelException(channelId, "dustLimit=$dustLimit is too small (min=$min)")
data class DustLimitTooLarge (override val channelId: ByteVector32, val dustLimit: Satoshi, val max: Satoshi) : ChannelException(channelId, "dustLimit=$dustLimit is too large (max=$max)")
data class ToSelfDelayTooHigh (override val channelId: ByteVector32, val toSelfDelay: CltvExpiryDelta, val max: CltvExpiryDelta) : ChannelException(channelId, "unreasonable to_self_delay=$toSelfDelay (max=$max)")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ sealed class ChannelType {
override val features: Set<Feature> get() = setOf(Feature.StaticRemoteKey, Feature.AnchorOutputs, Feature.ZeroReserveChannels)
}

object SimpleTaprootStaging : SupportedChannelType() {
override val name: String get() = "simple_taproot_staging"
override val features: Set<Feature> get() = setOf(Feature.StaticRemoteKey, Feature.AnchorOutputs, Feature.ZeroReserveChannels, Feature.SimpleTaprootStaging)
}
}

data class UnsupportedChannelType(val featureBits: Features) : ChannelType() {
Expand All @@ -73,6 +77,7 @@ sealed class ChannelType {
// @formatter:off
Features(Feature.StaticRemoteKey to FeatureSupport.Mandatory, Feature.AnchorOutputs to FeatureSupport.Mandatory, Feature.ZeroReserveChannels to FeatureSupport.Mandatory) -> SupportedChannelType.AnchorOutputsZeroReserve
Features(Feature.StaticRemoteKey to FeatureSupport.Mandatory, Feature.AnchorOutputs to FeatureSupport.Mandatory) -> SupportedChannelType.AnchorOutputs
Features(Feature.StaticRemoteKey to FeatureSupport.Mandatory, Feature.AnchorOutputs to FeatureSupport.Mandatory, Feature.ZeroReserveChannels to FeatureSupport.Mandatory, Feature.SimpleTaprootStaging to FeatureSupport.Mandatory) -> SupportedChannelType.SimpleTaprootStaging
else -> UnsupportedChannelType(features)
// @formatter:on
}
Expand Down
Loading
Loading