mirror of
https://github.com/aljazceru/breez-lnd.git
synced 2025-12-18 14:44:22 +01:00
feature: add new feature pkg to manage feature sets
This commit introduces a feature.Manager, which derives feature vectors for various contexts within the daemon. The sets can be described via a staticly compiled format, which makes any runtime adjustments to the feature sets when the manager is initialized.
This commit is contained in:
41
feature/set.go
Normal file
41
feature/set.go
Normal file
@@ -0,0 +1,41 @@
|
||||
package feature
|
||||
|
||||
// Set is an enum identifying various feature sets, which separates the single
|
||||
// feature namespace into distinct categories depending what context a feature
|
||||
// vector is being used.
|
||||
type Set uint8
|
||||
|
||||
const (
|
||||
// SetInit identifies features that should be sent in an Init message to
|
||||
// a remote peer.
|
||||
SetInit Set = iota
|
||||
|
||||
// SetLegacyGlobal identifies features that should be set in the legacy
|
||||
// GlobalFeatures field of an Init message, which maintains backwards
|
||||
// compatibility with nodes that haven't implemented flat features.
|
||||
SetLegacyGlobal
|
||||
|
||||
// SetNodeAnn identifies features that should be advertised on node
|
||||
// announcements.
|
||||
SetNodeAnn
|
||||
|
||||
// SetInvoice identifies features that should be advertised on invoices
|
||||
// generated by the daemon.
|
||||
SetInvoice
|
||||
)
|
||||
|
||||
// String returns a human-readable description of a Set.
|
||||
func (s Set) String() string {
|
||||
switch s {
|
||||
case SetInit:
|
||||
return "SetInit"
|
||||
case SetLegacyGlobal:
|
||||
return "SetLegacyGlobal"
|
||||
case SetNodeAnn:
|
||||
return "SetNodeAnn"
|
||||
case SetInvoice:
|
||||
return "SetInvoice"
|
||||
default:
|
||||
return "SetUnknown"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user