funding: always send a channel type in explicit mode
In this commit, we switch to always sending a channel type when we're in explicit mode. This is compatible with prior versions of lnd as they won't send a channel type, and we'll just arrive at the same type via the existing implicit funding. Fixes https://github.com/lightningnetwork/lnd/issues/6067
This commit is contained in:
1 parent
e58a9793b8
commit
99f79ea507
3 files changed
+78
-34
No files matched your search
+5
-5
@@ -1274,7 +1274,7 @@ func (f *Manager) handleFundingOpen(peer lnpeer.Peer,
|
||||
// the remote peer are signaling the proper feature bit if we're using
|
||||
// implicit negotiation, and simply the channel type sent over if we're
|
||||
// using explicit negotiation.
|
||||
wasExplicit, commitType, err := negotiateCommitmentType(
|
||||
wasExplicit, _, commitType, err := negotiateCommitmentType(
|
||||
msg.ChannelType, peer.LocalFeatures(), peer.RemoteFeatures(),
|
||||
false,
|
||||
)
|
||||
@@ -1599,14 +1599,14 @@ func (f *Manager) handleFundingAccept(peer lnpeer.Peer,
|
||||
// channel type in the accept_channel response if we didn't
|
||||
// explicitly set it in the open_channel message. For now, let's
|
||||
// just log the problem instead of failing the funding flow.
|
||||
implicitChannelType := implicitNegotiateCommitmentType(
|
||||
_, implicitChannelType := implicitNegotiateCommitmentType(
|
||||
peer.LocalFeatures(), peer.RemoteFeatures(),
|
||||
)
|
||||
|
||||
// We pass in false here as the funder since at this point, we
|
||||
// didn't set a chan type ourselves, so falling back to
|
||||
// implicit funding is acceptable.
|
||||
_, negotiatedChannelType, err := negotiateCommitmentType(
|
||||
_, _, negotiatedChannelType, err := negotiateCommitmentType(
|
||||
msg.ChannelType, peer.LocalFeatures(),
|
||||
peer.RemoteFeatures(), false,
|
||||
)
|
||||
@@ -3258,7 +3258,7 @@ func (f *Manager) handleInitFundingMsg(msg *InitFundingMsg) {
|
||||
// Before we init the channel, we'll also check to see what commitment
|
||||
// format we can use with this peer. This is dependent on *both* us and
|
||||
// the remote peer are signaling the proper feature bit.
|
||||
_, commitType, err := negotiateCommitmentType(
|
||||
_, chanType, commitType, err := negotiateCommitmentType(
|
||||
msg.ChannelType, msg.Peer.LocalFeatures(),
|
||||
msg.Peer.RemoteFeatures(), true,
|
||||
)
|
||||
@@ -3415,7 +3415,7 @@ func (f *Manager) handleInitFundingMsg(msg *InitFundingMsg) {
|
||||
FirstCommitmentPoint: ourContribution.FirstCommitmentPoint,
|
||||
ChannelFlags: channelFlags,
|
||||
UpfrontShutdownScript: shutdown,
|
||||
ChannelType: msg.ChannelType,
|
||||
ChannelType: chanType,
|
||||
LeaseExpiry: leaseExpiry,
|
||||
}
|
||||
if err := msg.Peer.SendMessage(true, &fundingOpen); err != nil {
|
||||
|
||||
Reference in new issue
Block a user