Skip to content

Conversation

GeorgeTsagk
Copy link
Member

@GeorgeTsagk GeorgeTsagk commented Aug 19, 2025

Description

Adds the necessary subsystem to handle custom feature bit negotiation for tap channels. This allows us to introduce new channel features that would otherwise break backwards compatibility. We piggy-back on the existing LND messages (init & reestablish) to nest the tlv.Blob that encodes the CustomChannelType (uint64) type.

The set of active features over a channel is the intersection of the locally supported features and the features that the peer provided.

Currently we follow a "global" approach on the feature bits that we support. We don't make any distinctions between peers or channels. The locally supported feature bits is a static set.

We also don't allow reading/writing feature bits per channel, but per peer. For now the funding outpoint / funding blob arguments are ignored. When we establish a feature-set with a peer, that applies to all of our channels with that peer.

An older tapd node (i.e a node that does not contain the contents of this PR) will be treated as if they provided an empty feature set (uint64 with 0's)

Dependencies

LND lightningnetwork/lnd#10182
Lndclient lightninglabs/lndclient#239
LiT itest: lightninglabs/lightning-terminal#1138

@GeorgeTsagk GeorgeTsagk self-assigned this Aug 19, 2025
@levmi levmi moved this from 🆕 New to 🏗 In progress in Taproot-Assets Project Board Aug 21, 2025
@GeorgeTsagk GeorgeTsagk force-pushed the feature-bits branch 2 times, most recently from eb267a6 to 77f9420 Compare August 28, 2025 13:02
@GeorgeTsagk GeorgeTsagk marked this pull request as ready for review August 28, 2025 13:04
@coveralls
Copy link

coveralls commented Aug 28, 2025

Pull Request Test Coverage Report for Build 17382758755

Details

  • 54 of 168 (32.14%) changed or added relevant lines in 7 files are covered.
  • 64 unchanged lines in 16 files lost coverage.
  • Overall coverage increased (+8.0%) to 56.593%

Changes Missing Coverage Covered Lines Changed/Added Lines %
tapcfg/server.go 5 7 71.43%
tapchannel/aux_traffic_shaper.go 0 5 0.0%
tapfeatures/aux_feature_bits.go 8 14 57.14%
server.go 0 32 0.0%
tapfeatures/aux_channel_negotiator.go 21 90 23.33%
Files with Coverage Reduction New Missed Lines %
fn/context_guard.go 1 91.94%
itest/tapd_harness.go 1 85.63%
server.go 2 39.33%
tapchannel/aux_traffic_shaper.go 2 6.03%
tapdb/addrs.go 2 78.23%
tapdb/mssmt.go 2 89.55%
tapdb/universe.go 2 80.85%
itest/assertions.go 3 89.08%
proof/verifier.go 3 86.82%
tapdb/assets_store.go 3 79.49%
Totals Coverage Status
Change from base Build 17301129198: 8.0%
Covered Lines: 61017
Relevant Lines: 107817

💛 - Coveralls

Copy link
Member

@jtobin jtobin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few initial questions and comments, mostly about the AuxChanNegotiator handling in the RFQ system.

Copy link
Member

@jtobin jtobin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Made another pass, with some additional questions and suggestions. I think everything on my end should be resolved after this.

@@ -125,13 +127,23 @@ type AssetSalePolicy struct {
// wants us to produce NoOp HTLCs.
NoOpHTLCs bool
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can anything pathological happen if we register an AssetSalePolicy with NoOpHTLCs enabled/disabled, but then restart with NoOpHTLCs disabled/enabled before the policy expires?

@@ -125,13 +127,23 @@ type AssetSalePolicy struct {
// wants us to produce NoOp HTLCs.
NoOpHTLCs bool

// auxChannelNegotiator is used to query the supported feature bits that
// are supported by a peer, or a channel.
auxChanNegotiator *tapfeatures.AuxChannelNegotiator
Copy link
Member

@jtobin jtobin Sep 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Revisiting: see my PR to this branch for a potential alternative way to handle this.

func NewAssetSalePolicy(quote rfqmsg.BuyAccept, noop bool) *AssetSalePolicy {
func NewAssetSalePolicy(quote rfqmsg.BuyAccept, noop bool,
chanNegotiator *tapfeatures.AuxChannelNegotiator,
peer route.Vertex) *AssetSalePolicy {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the 'peer' argument here is unnecessary, as it can be gotten from quote.Peer?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 🏗 In progress
Development

Successfully merging this pull request may close these issues.

4 participants