2019-08-06 07:34:46 +03:00
|
|
|
// +build dev
|
|
|
|
|
|
|
|
package lncfg
|
|
|
|
|
2020-03-06 18:11:48 +03:00
|
|
|
// ProtocolOptions is a struct that we use to be able to test backwards
|
2019-08-06 07:34:46 +03:00
|
|
|
// compatibility of protocol additions, while defaulting to the latest within
|
2020-03-06 18:11:48 +03:00
|
|
|
// lnd, or to enable experimental protocol changes.
|
|
|
|
type ProtocolOptions struct {
|
|
|
|
// LegacyOnionFormat if set to true, then we won't signal
|
|
|
|
// TLVOnionPayloadOptional. As a result, nodes that include us in the
|
|
|
|
// route won't use the new modern onion framing.
|
|
|
|
LegacyOnionFormat bool `long:"legacyonion" description:"force node to not advertise the new modern TLV onion format"`
|
2019-09-11 15:44:31 +03:00
|
|
|
|
|
|
|
// CommitmentTweak guards if we should use the old legacy commitment
|
|
|
|
// protocol, or the newer variant that doesn't have a tweak for the
|
|
|
|
// remote party's output in the commitment. If set to true, then we
|
|
|
|
// won't signal StaticRemoteKeyOptional.
|
|
|
|
CommitmentTweak bool `long:"committweak" description:"force node to not advertise the new commitment format"`
|
2020-03-06 18:11:48 +03:00
|
|
|
|
|
|
|
// Anchors should be set if we want to support opening or accepting
|
|
|
|
// channels having the anchor commitment type.
|
2020-03-14 04:52:33 +03:00
|
|
|
Anchors bool `long:"anchors" description:"EXPERIMENTAL: enable experimental support for anchor commitments, won't work with watchtowers"`
|
2019-08-06 07:34:46 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
// LegacyOnion returns true if the old legacy onion format should be used when
|
|
|
|
// we're an intermediate or final hop. This controls if we set the
|
|
|
|
// TLVOnionPayloadOptional bit or not.
|
2020-03-06 18:11:48 +03:00
|
|
|
func (l *ProtocolOptions) LegacyOnion() bool {
|
|
|
|
return l.LegacyOnionFormat
|
2019-08-06 07:34:46 +03:00
|
|
|
}
|
2019-09-11 15:44:31 +03:00
|
|
|
|
2020-03-06 18:11:48 +03:00
|
|
|
// NoStaticRemoteKey returns true if the old commitment format with a tweaked
|
|
|
|
// remote key should be used for new funded channels.
|
|
|
|
func (l *ProtocolOptions) NoStaticRemoteKey() bool {
|
2019-09-11 15:44:31 +03:00
|
|
|
return l.CommitmentTweak
|
|
|
|
}
|
2020-03-06 18:11:48 +03:00
|
|
|
|
2020-03-14 04:50:45 +03:00
|
|
|
// AnchorCommitments returns true if support for the anchor commitment type
|
2020-03-06 18:11:48 +03:00
|
|
|
// should be signaled.
|
|
|
|
func (l *ProtocolOptions) AnchorCommitments() bool {
|
|
|
|
return l.Anchors
|
|
|
|
}
|