mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-06-29 18:10:48 +02:00
lncfg+lnd: gate usage of tweakless commitments based on local/global feature bits
In this commit, we add a new legacy protocol command line flag: `committweak`. When set, this forces the node to NOT signal usage of the new commitment format. This allows us to test that we're able to properly establish channels with legacy nodes. Within the server, we'll now gate our signalling of this new feature based on the legacy protocol config. Finally, when accepting/initiating a new channel funding, we'll now check both the local and remote global feature bits, only using the new commitment format if both signal the global feature bit.
This commit is contained in:
11
server.go
11
server.go
@ -324,6 +324,12 @@ func newServer(listenAddrs []net.Addr, chanDB *channeldb.DB,
|
||||
globalFeatures.Set(lnwire.TLVOnionPayloadOptional)
|
||||
}
|
||||
|
||||
// Similarly, we default to the new modern commitment format unless the
|
||||
// legacy commitment config is set to true.
|
||||
if !cfg.LegacyProtocol.LegacyCommitment() {
|
||||
globalFeatures.Set(lnwire.StaticRemoteKeyOptional)
|
||||
}
|
||||
|
||||
var serializedPubKey [33]byte
|
||||
copy(serializedPubKey[:], privKey.PubKey().SerializeCompressed())
|
||||
|
||||
@ -388,8 +394,9 @@ func newServer(listenAddrs []net.Addr, chanDB *channeldb.DB,
|
||||
peerConnectedListeners: make(map[string][]chan<- lnpeer.Peer),
|
||||
peerDisconnectedListeners: make(map[string][]chan<- struct{}),
|
||||
|
||||
globalFeatures: lnwire.NewFeatureVector(globalFeatures,
|
||||
lnwire.GlobalFeatures),
|
||||
globalFeatures: lnwire.NewFeatureVector(
|
||||
globalFeatures, lnwire.GlobalFeatures,
|
||||
),
|
||||
quit: make(chan struct{}),
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user