Skip to content

Commit 1a58486

Browse files
committed
tapfeatures: add aux feature bits
1 parent 05cd895 commit 1a58486

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed

tapfeatures/aux_feature_bits.go

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
package tapfeatures
2+
3+
import "github.com/lightningnetwork/lnd/lnwire"
4+
5+
const (
6+
// NoOpHTLCsRequired is a feature bit that declares the noop-htlcs as a
7+
// required feature.
8+
NoOpHTLCsRequired lnwire.FeatureBit = 0
9+
10+
// NoOpHTLCsOptional is a feature bit that declares the noop-htlcs as an
11+
// optional feature.
12+
NoOpHTLCsOptional lnwire.FeatureBit = 1
13+
14+
// STXORequired is a feature bit that declares STXO proofs as a required
15+
// feature.
16+
STXORequired lnwire.FeatureBit = 2
17+
18+
// STXOOptional is a feature bit that declares the STXO proofs as an
19+
// optional feature.
20+
STXOOptional lnwire.FeatureBit = 3
21+
)
22+
23+
// featureNames keeps track of the string description of known features.
24+
var featureNames = map[lnwire.FeatureBit]string{
25+
NoOpHTLCsRequired: "noop-htlcs",
26+
NoOpHTLCsOptional: "noop-htlcs",
27+
STXORequired: "stxo-proofs",
28+
STXOOptional: "stxo-proofs",
29+
}
30+
31+
// ourFeatures returns a slice containing all of the locally supported features.
32+
func ourFeatures() []lnwire.FeatureBit {
33+
// TODO(george): instead of hosting the supported features in the
34+
// following slice we could make something more explicit / modular.
35+
return []lnwire.FeatureBit{
36+
NoOpHTLCsOptional,
37+
STXOOptional,
38+
}
39+
}
40+
41+
// getLocalFeatureVec returns the feature vector of the currently supported
42+
// features. This set of features may change between different versions of tapd,
43+
// and that exactly is its purpose. This feature vector denotes which features
44+
// of tap channels are currently supported, in order to maintain compatibility
45+
// with our peers.
46+
func getLocalFeatureVec() *lnwire.RawFeatureVector {
47+
ourFeatures := ourFeatures()
48+
return lnwire.NewRawFeatureVector(
49+
ourFeatures...,
50+
)
51+
}

0 commit comments

Comments
 (0)