Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,13 @@ sealed class Feature {
override val scopes: Set<FeatureScope> get() = setOf(FeatureScope.Init, FeatureScope.Node)
}

// README: this is not the feature bit specified in the BOLT, this one is specific to Phoenix
@Serializable
object SimpleTaprootChannels : Feature() {
override val rfcName get() = "simple_taproot_channels"
override val mandatory get() = 564
override val scopes: Set<FeatureScope> get() = setOf(FeatureScope.Init, FeatureScope.Node)
}
}

@Serializable
Expand Down Expand Up @@ -294,7 +301,8 @@ data class Features(val activated: Map<Feature, FeatureSupport>, val unknown: Se
Feature.WakeUpNotificationProvider,
Feature.ExperimentalSplice,
Feature.OnTheFlyFunding,
Feature.FundingFeeCredit
Feature.FundingFeeCredit,
Feature.SimpleTaprootChannels
)

operator fun invoke(bytes: ByteVector): Features = invoke(bytes.toByteArray())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ data class NodeParams(
Feature.Wumbo to FeatureSupport.Optional,
Feature.StaticRemoteKey to FeatureSupport.Mandatory,
Feature.AnchorOutputs to FeatureSupport.Optional, // can't set Mandatory because peers prefers AnchorOutputsZeroFeeHtlcTx
Feature.SimpleTaprootChannels to FeatureSupport.Optional,
Feature.RouteBlinding to FeatureSupport.Optional,
Feature.DualFunding to FeatureSupport.Mandatory,
Feature.ShutdownAnySegwit to FeatureSupport.Mandatory,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,4 +92,9 @@ data class PleasePublishYourCommitment (override val channelId: Byte
data class CommandUnavailableInThisState (override val channelId: ByteVector32, val state: String) : ChannelException(channelId, "cannot execute command in state=$state")
data class ForbiddenDuringSplice (override val channelId: ByteVector32, val command: String?) : ChannelException(channelId, "cannot process $command while splicing")
data class InvalidSpliceRequest (override val channelId: ByteVector32) : ChannelException(channelId, "invalid splice request")
data class MissingCommitNonce (override val channelId: ByteVector32, val fundingTxId: TxId, val commitmentNumber: Long) : ChannelException(channelId, "missing commit nonce for funding tx $fundingTxId commitmentNumber $commitmentNumber")
data class InvalidCommitNonce (override val channelId: ByteVector32, val fundingTxId: TxId, val commitmentNumber: Long) : ChannelException(channelId, "invalid commit nonce for funding tx $fundingTxId commitmentNumber $commitmentNumber")
data class MissingFundingNonce (override val channelId: ByteVector32, val fundingTxId: TxId) : ChannelException(channelId, "missing funding nonce for funding tx $fundingTxId")
data class InvalidFundingNonce (override val channelId: ByteVector32, val fundingTxId: TxId) : ChannelException(channelId, "invalid funding nonce for funding tx $fundingTxId")
data class MissingClosingNonce (override val channelId: ByteVector32) : ChannelException(channelId, "missing closing nonce")
// @formatter:on
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ data class ChannelFeatures(val features: Set<Feature>) {
* In addition to channel types features, the following features will be added to the permanent channel features if they
* are supported by both peers.
*/
private val permanentChannelFeatures = setOf(Feature.DualFunding)
private val permanentChannelFeatures: Set<Feature> = setOf(Feature.DualFunding)
}

}
Expand Down Expand Up @@ -65,6 +65,12 @@ sealed class ChannelType {
override val commitmentFormat: Transactions.CommitmentFormat get() = Transactions.CommitmentFormat.AnchorOutputs
}

object SimpleTaprootChannels : SupportedChannelType() {
override val name: String get() = "simple_taproot_channel"
override val features: Set<Feature> get() = setOf(Feature.SimpleTaprootChannels, Feature.ZeroReserveChannels)
override val permanentChannelFeatures: Set<Feature> get() = setOf(Feature.ZeroReserveChannels)
override val commitmentFormat: Transactions.CommitmentFormat get() = Transactions.CommitmentFormat.SimpleTaprootChannels
}
}

data class UnsupportedChannelType(val featureBits: Features) : ChannelType() {
Expand All @@ -79,6 +85,7 @@ sealed class ChannelType {
// NB: Bolt 2: features must exactly match in order to identify a channel type.
fun fromFeatures(features: Features): ChannelType = when (features) {
// @formatter:off
Features(Feature.SimpleTaprootChannels to FeatureSupport.Mandatory, Feature.ZeroReserveChannels to FeatureSupport.Mandatory) -> SupportedChannelType.SimpleTaprootChannels
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
else -> UnsupportedChannelType(features)
Expand Down
Loading