mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-09-05 17:05:50 +02:00
cfg: move experimental options to main protocol cfg
This commit is contained in:
@@ -1667,8 +1667,7 @@ func ValidateConfig(cfg Config, interceptor signal.Interceptor, fileParser,
|
|||||||
|
|
||||||
// If the experimental protocol options specify any protocol messages
|
// If the experimental protocol options specify any protocol messages
|
||||||
// that we want to handle as custom messages, set them now.
|
// that we want to handle as custom messages, set them now.
|
||||||
//nolint:lll
|
customMsg := cfg.ProtocolOptions.CustomMessageOverrides()
|
||||||
customMsg := cfg.ProtocolOptions.ExperimentalProtocol.CustomMessageOverrides()
|
|
||||||
|
|
||||||
// We can safely set our custom override values during startup because
|
// We can safely set our custom override values during startup because
|
||||||
// startup is blocked on config parsing.
|
// startup is blocked on config parsing.
|
||||||
|
@@ -317,6 +317,10 @@
|
|||||||
* [Add inbound fees](https://github.com/lightningnetwork/lnd/pull/8723) to
|
* [Add inbound fees](https://github.com/lightningnetwork/lnd/pull/8723) to
|
||||||
`subscribeChannelGraph`.
|
`subscribeChannelGraph`.
|
||||||
|
|
||||||
|
* [Moved](https://github.com/lightningnetwork/lnd/pull/8744) the experimental
|
||||||
|
"custom" options to the main protocol config so that they can be used without
|
||||||
|
the dev build flag set.
|
||||||
|
|
||||||
### Logging
|
### Logging
|
||||||
* [Add the htlc amount](https://github.com/lightningnetwork/lnd/pull/8156) to
|
* [Add the htlc amount](https://github.com/lightningnetwork/lnd/pull/8156) to
|
||||||
contract court logs in case of timed-out HTLCs in order to easily spot dust
|
contract court logs in case of timed-out HTLCs in order to easily spot dust
|
||||||
|
@@ -2,6 +2,11 @@
|
|||||||
|
|
||||||
package lncfg
|
package lncfg
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/lightningnetwork/lnd/feature"
|
||||||
|
"github.com/lightningnetwork/lnd/lnwire"
|
||||||
|
)
|
||||||
|
|
||||||
// ProtocolOptions is a struct that we use to be able to test backwards
|
// ProtocolOptions is a struct that we use to be able to test backwards
|
||||||
// compatibility of protocol additions, while defaulting to the latest within
|
// compatibility of protocol additions, while defaulting to the latest within
|
||||||
// lnd, or to enable experimental protocol changes.
|
// lnd, or to enable experimental protocol changes.
|
||||||
@@ -57,6 +62,23 @@ type ProtocolOptions struct {
|
|||||||
|
|
||||||
// NoRouteBlindingOption disables forwarding of payments in blinded routes.
|
// NoRouteBlindingOption disables forwarding of payments in blinded routes.
|
||||||
NoRouteBlindingOption bool `long:"no-route-blinding" description:"do not forward payments that are a part of a blinded route"`
|
NoRouteBlindingOption bool `long:"no-route-blinding" description:"do not forward payments that are a part of a blinded route"`
|
||||||
|
|
||||||
|
// CustomMessage allows the custom message APIs to handle messages with
|
||||||
|
// the provided protocol numbers, which fall outside the custom message
|
||||||
|
// number range.
|
||||||
|
CustomMessage []uint16 `long:"custom-message" description:"allows the custom message apis to send and report messages with the protocol number provided that fall outside of the custom message number range."`
|
||||||
|
|
||||||
|
// CustomInit specifies feature bits to advertise in the node's init
|
||||||
|
// message.
|
||||||
|
CustomInit []uint16 `long:"custom-init" description:"custom feature bits — numbers defined in BOLT 9 — to advertise in the node's init message"`
|
||||||
|
|
||||||
|
// CustomNodeAnn specifies custom feature bits to advertise in the
|
||||||
|
// node's announcement message.
|
||||||
|
CustomNodeAnn []uint16 `long:"custom-nodeann" description:"custom feature bits — numbers defined in BOLT 9 — to advertise in the node's announcement message"`
|
||||||
|
|
||||||
|
// CustomInvoice specifies custom feature bits to advertise in the
|
||||||
|
// node's invoices.
|
||||||
|
CustomInvoice []uint16 `long:"custom-invoice" description:"custom feature bits — numbers defined in BOLT 9 — to advertise in the node's invoices"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Wumbo returns true if lnd should permit the creation and acceptance of wumbo
|
// Wumbo returns true if lnd should permit the creation and acceptance of wumbo
|
||||||
@@ -105,3 +127,29 @@ func (l *ProtocolOptions) NoTimestampsQuery() bool {
|
|||||||
func (l *ProtocolOptions) NoRouteBlinding() bool {
|
func (l *ProtocolOptions) NoRouteBlinding() bool {
|
||||||
return l.NoRouteBlindingOption
|
return l.NoRouteBlindingOption
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// CustomMessageOverrides returns the set of protocol messages that we override
|
||||||
|
// to allow custom handling.
|
||||||
|
func (p ProtocolOptions) CustomMessageOverrides() []uint16 {
|
||||||
|
return p.CustomMessage
|
||||||
|
}
|
||||||
|
|
||||||
|
// CustomFeatures returns a custom set of feature bits to advertise.
|
||||||
|
func (p ProtocolOptions) CustomFeatures() map[feature.Set][]lnwire.FeatureBit {
|
||||||
|
customFeatures := make(map[feature.Set][]lnwire.FeatureBit)
|
||||||
|
|
||||||
|
setFeatures := func(set feature.Set, bits []uint16) {
|
||||||
|
for _, customFeature := range bits {
|
||||||
|
customFeatures[set] = append(
|
||||||
|
customFeatures[set],
|
||||||
|
lnwire.FeatureBit(customFeature),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
setFeatures(feature.SetInit, p.CustomInit)
|
||||||
|
setFeatures(feature.SetNodeAnn, p.CustomNodeAnn)
|
||||||
|
setFeatures(feature.SetInvoice, p.CustomInvoice)
|
||||||
|
|
||||||
|
return customFeatures
|
||||||
|
}
|
||||||
|
@@ -3,23 +3,7 @@
|
|||||||
|
|
||||||
package lncfg
|
package lncfg
|
||||||
|
|
||||||
import (
|
|
||||||
"github.com/lightningnetwork/lnd/feature"
|
|
||||||
"github.com/lightningnetwork/lnd/lnwire"
|
|
||||||
)
|
|
||||||
|
|
||||||
// ExperimentalProtocol is a sub-config that houses any experimental protocol
|
// ExperimentalProtocol is a sub-config that houses any experimental protocol
|
||||||
// features that also require a build-tag to activate.
|
// features that also require a build-tag to activate.
|
||||||
type ExperimentalProtocol struct {
|
type ExperimentalProtocol struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
// CustomMessageOverrides returns the set of protocol messages that we override
|
|
||||||
// to allow custom handling.
|
|
||||||
func (p ExperimentalProtocol) CustomMessageOverrides() []uint16 {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// CustomFeatures returns a custom set of feature bits to advertise.
|
|
||||||
func (p ExperimentalProtocol) CustomFeatures() map[feature.Set][]lnwire.FeatureBit {
|
|
||||||
return map[feature.Set][]lnwire.FeatureBit{}
|
|
||||||
}
|
|
||||||
|
@@ -3,49 +3,7 @@
|
|||||||
|
|
||||||
package lncfg
|
package lncfg
|
||||||
|
|
||||||
import (
|
|
||||||
"github.com/lightningnetwork/lnd/feature"
|
|
||||||
"github.com/lightningnetwork/lnd/lnwire"
|
|
||||||
)
|
|
||||||
|
|
||||||
// ExperimentalProtocol is a sub-config that houses any experimental protocol
|
// ExperimentalProtocol is a sub-config that houses any experimental protocol
|
||||||
// features that also require a build-tag to activate.
|
// features that also require a build-tag to activate.
|
||||||
//
|
|
||||||
//nolint:lll
|
|
||||||
type ExperimentalProtocol struct {
|
type ExperimentalProtocol struct {
|
||||||
CustomMessage []uint16 `long:"custom-message" description:"allows the custom message apis to send and report messages with the protocol number provided that fall outside of the custom message number range."`
|
|
||||||
|
|
||||||
CustomInit []uint16 `long:"custom-init" description:"custom feature bits to advertise in the node's init message"`
|
|
||||||
|
|
||||||
CustomNodeAnn []uint16 `long:"custom-nodeann" description:"custom feature bits to advertise in the node's announcement message"`
|
|
||||||
|
|
||||||
CustomInvoice []uint16 `long:"custom-invoice" description:"custom feature bits to advertise in the node's invoices"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// CustomMessageOverrides returns the set of protocol messages that we override
|
|
||||||
// to allow custom handling.
|
|
||||||
func (p ExperimentalProtocol) CustomMessageOverrides() []uint16 {
|
|
||||||
return p.CustomMessage
|
|
||||||
}
|
|
||||||
|
|
||||||
// CustomFeatures returns a custom set of feature bits to advertise.
|
|
||||||
//
|
|
||||||
//nolint:lll
|
|
||||||
func (p ExperimentalProtocol) CustomFeatures() map[feature.Set][]lnwire.FeatureBit {
|
|
||||||
customFeatures := make(map[feature.Set][]lnwire.FeatureBit)
|
|
||||||
|
|
||||||
setFeatures := func(set feature.Set, bits []uint16) {
|
|
||||||
for _, customFeature := range bits {
|
|
||||||
customFeatures[set] = append(
|
|
||||||
customFeatures[set],
|
|
||||||
lnwire.FeatureBit(customFeature),
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
setFeatures(feature.SetInit, p.CustomInit)
|
|
||||||
setFeatures(feature.SetNodeAnn, p.CustomNodeAnn)
|
|
||||||
setFeatures(feature.SetInvoice, p.CustomInvoice)
|
|
||||||
|
|
||||||
return customFeatures
|
|
||||||
}
|
}
|
||||||
|
@@ -2,6 +2,11 @@
|
|||||||
|
|
||||||
package lncfg
|
package lncfg
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/lightningnetwork/lnd/feature"
|
||||||
|
"github.com/lightningnetwork/lnd/lnwire"
|
||||||
|
)
|
||||||
|
|
||||||
// ProtocolOptions is a struct that we use to be able to test backwards
|
// ProtocolOptions is a struct that we use to be able to test backwards
|
||||||
// compatibility of protocol additions, while defaulting to the latest within
|
// compatibility of protocol additions, while defaulting to the latest within
|
||||||
// lnd, or to enable experimental protocol changes.
|
// lnd, or to enable experimental protocol changes.
|
||||||
@@ -60,6 +65,23 @@ type ProtocolOptions struct {
|
|||||||
|
|
||||||
// NoRouteBlindingOption disables forwarding of payments in blinded routes.
|
// NoRouteBlindingOption disables forwarding of payments in blinded routes.
|
||||||
NoRouteBlindingOption bool `long:"no-route-blinding" description:"do not forward payments that are a part of a blinded route"`
|
NoRouteBlindingOption bool `long:"no-route-blinding" description:"do not forward payments that are a part of a blinded route"`
|
||||||
|
|
||||||
|
// CustomMessage allows the custom message APIs to handle messages with
|
||||||
|
// the provided protocol numbers, which fall outside the custom message
|
||||||
|
// number range.
|
||||||
|
CustomMessage []uint16 `long:"custom-message" description:"allows the custom message apis to send and report messages with the protocol number provided that fall outside of the custom message number range."`
|
||||||
|
|
||||||
|
// CustomInit specifies feature bits to advertise in the node's init
|
||||||
|
// message.
|
||||||
|
CustomInit []uint16 `long:"custom-init" description:"custom feature bits to advertise in the node's init message"`
|
||||||
|
|
||||||
|
// CustomNodeAnn specifies custom feature bits to advertise in the
|
||||||
|
// node's announcement message.
|
||||||
|
CustomNodeAnn []uint16 `long:"custom-nodeann" description:"custom feature bits to advertise in the node's announcement message"`
|
||||||
|
|
||||||
|
// CustomInvoice specifies custom feature bits to advertise in the
|
||||||
|
// node's invoices.
|
||||||
|
CustomInvoice []uint16 `long:"custom-invoice" description:"custom feature bits to advertise in the node's invoices"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Wumbo returns true if lnd should permit the creation and acceptance of wumbo
|
// Wumbo returns true if lnd should permit the creation and acceptance of wumbo
|
||||||
@@ -100,3 +122,29 @@ func (l *ProtocolOptions) NoAnySegwit() bool {
|
|||||||
func (l *ProtocolOptions) NoRouteBlinding() bool {
|
func (l *ProtocolOptions) NoRouteBlinding() bool {
|
||||||
return l.NoRouteBlindingOption
|
return l.NoRouteBlindingOption
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// CustomMessageOverrides returns the set of protocol messages that we override
|
||||||
|
// to allow custom handling.
|
||||||
|
func (l ProtocolOptions) CustomMessageOverrides() []uint16 {
|
||||||
|
return l.CustomMessage
|
||||||
|
}
|
||||||
|
|
||||||
|
// CustomFeatures returns a custom set of feature bits to advertise.
|
||||||
|
func (l ProtocolOptions) CustomFeatures() map[feature.Set][]lnwire.FeatureBit {
|
||||||
|
customFeatures := make(map[feature.Set][]lnwire.FeatureBit)
|
||||||
|
|
||||||
|
setFeatures := func(set feature.Set, bits []uint16) {
|
||||||
|
for _, customFeature := range bits {
|
||||||
|
customFeatures[set] = append(
|
||||||
|
customFeatures[set],
|
||||||
|
lnwire.FeatureBit(customFeature),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
setFeatures(feature.SetInit, l.CustomInit)
|
||||||
|
setFeatures(feature.SetNodeAnn, l.CustomNodeAnn)
|
||||||
|
setFeatures(feature.SetInvoice, l.CustomInvoice)
|
||||||
|
|
||||||
|
return customFeatures
|
||||||
|
}
|
||||||
|
@@ -1306,6 +1306,39 @@
|
|||||||
; Set to disable blinded route forwarding.
|
; Set to disable blinded route forwarding.
|
||||||
; protocol.no-route-blinding=false
|
; protocol.no-route-blinding=false
|
||||||
|
|
||||||
|
; Set to handle messages of a particular type that falls outside of the
|
||||||
|
; custom message number range (i.e. 513 is onion messages). Note that you can
|
||||||
|
; set this option as many times as you want to support more than one custom
|
||||||
|
; message type.
|
||||||
|
; Default:
|
||||||
|
; protocol.custom-message=
|
||||||
|
; Example:
|
||||||
|
; protocol.custom-message=513
|
||||||
|
|
||||||
|
; Specifies feature bits — numbers defined in BOLT 9 — to advertise in the
|
||||||
|
; node's init message. Note that you can set this option as many times as you
|
||||||
|
; want to support more than one feature bit.
|
||||||
|
; Default:
|
||||||
|
; protocol.custom-init=
|
||||||
|
; Example:
|
||||||
|
; protocol.custom-init=39
|
||||||
|
|
||||||
|
; Specifies custom feature bits — numbers defined in BOLT 9 — to advertise in
|
||||||
|
; the node's announcement message. Note that you can set this option as many
|
||||||
|
; times as you want to support more than one feature bit.
|
||||||
|
; Default:
|
||||||
|
; protocol.custom-nodeann=
|
||||||
|
; Example:
|
||||||
|
; protocol.custom-nodeann=39
|
||||||
|
|
||||||
|
; Specifies custom feature bits — numbers defined in BOLT 9 — to advertise in
|
||||||
|
; the node's invoices. Note that you can set this option as many times as you
|
||||||
|
; want to support more than one feature bit.
|
||||||
|
; Default:
|
||||||
|
; protocol.custom-invoice=
|
||||||
|
; Example:
|
||||||
|
; protocol.custom-invoice=39
|
||||||
|
|
||||||
[db]
|
[db]
|
||||||
|
|
||||||
; The selected database backend. The current default backend is "bolt". lnd
|
; The selected database backend. The current default backend is "bolt". lnd
|
||||||
|
@@ -547,7 +547,7 @@ func newServer(cfg *Config, listenAddrs []net.Addr,
|
|||||||
NoOptionScidAlias: !cfg.ProtocolOptions.ScidAlias(),
|
NoOptionScidAlias: !cfg.ProtocolOptions.ScidAlias(),
|
||||||
NoZeroConf: !cfg.ProtocolOptions.ZeroConf(),
|
NoZeroConf: !cfg.ProtocolOptions.ZeroConf(),
|
||||||
NoAnySegwit: cfg.ProtocolOptions.NoAnySegwit(),
|
NoAnySegwit: cfg.ProtocolOptions.NoAnySegwit(),
|
||||||
CustomFeatures: cfg.ProtocolOptions.ExperimentalProtocol.CustomFeatures(),
|
CustomFeatures: cfg.ProtocolOptions.CustomFeatures(),
|
||||||
NoTaprootChans: !cfg.ProtocolOptions.TaprootChans,
|
NoTaprootChans: !cfg.ProtocolOptions.TaprootChans,
|
||||||
NoRouteBlinding: cfg.ProtocolOptions.NoRouteBlinding(),
|
NoRouteBlinding: cfg.ProtocolOptions.NoRouteBlinding(),
|
||||||
})
|
})
|
||||||
|
Reference in New Issue
Block a user