funding: stop naming commit types chanType

negotiateCommitmentType returns both a chanType and a commitType, so it
is really confusing when the commitType is called chanType instead.
This commit is contained in:
Matt Morehouse committed 2023-05-17 11:27:41 -05:00
1 parent ec85b5be72
commit e59cd7f91d
2 files changed
+5 -5

No files matched your search

+2 -2
View File
@@ -38,10 +38,10 @@ func negotiateCommitmentType(desiredChanType *lnwire.ChannelType, local,
local, remote, lnwire.ExplicitChannelTypeOptional, local, remote, lnwire.ExplicitChannelTypeOptional,
) { ) {
chanType, err := explicitNegotiateCommitmentType( commitType, err := explicitNegotiateCommitmentType(
*desiredChanType, local, remote, *desiredChanType, local, remote,
) )
return true, desiredChanType, chanType, err return true, desiredChanType, commitType, err
} }
// If we're the funder, and we are attempting to use an // If we're the funder, and we are attempting to use an
+3 -3
View File
@@ -1883,14 +1883,14 @@ func (f *Manager) handleFundingAccept(peer lnpeer.Peer,
// channel type in the accept_channel response if we didn't // channel type in the accept_channel response if we didn't
// explicitly set it in the open_channel message. For now, let's // explicitly set it in the open_channel message. For now, let's
// just log the problem instead of failing the funding flow. // just log the problem instead of failing the funding flow.
_, implicitChannelType := implicitNegotiateCommitmentType( _, implicitCommitType := implicitNegotiateCommitmentType(
peer.LocalFeatures(), peer.RemoteFeatures(), peer.LocalFeatures(), peer.RemoteFeatures(),
) )
// We pass in false here as the funder since at this point, we // We pass in false here as the funder since at this point, we
// didn't set a chan type ourselves, so falling back to // didn't set a chan type ourselves, so falling back to
// implicit funding is acceptable. // implicit funding is acceptable.
_, _, negotiatedChannelType, err := negotiateCommitmentType( _, _, negotiatedCommitType, err := negotiateCommitmentType(
msg.ChannelType, peer.LocalFeatures(), msg.ChannelType, peer.LocalFeatures(),
peer.RemoteFeatures(), false, peer.RemoteFeatures(), false,
) )
@@ -1904,7 +1904,7 @@ func (f *Manager) handleFundingAccept(peer lnpeer.Peer,
// didn't send one in the first place, we check that it's the // didn't send one in the first place, we check that it's the
// same type we'd have arrived through implicit negotiation. If // same type we'd have arrived through implicit negotiation. If
// it's another type, we fail the flow. // it's another type, we fail the flow.
if implicitChannelType != negotiatedChannelType { if implicitCommitType != negotiatedCommitType {
err := errors.New("negotiated unexpected channel type") err := errors.New("negotiated unexpected channel type")
f.failFundingFlow(peer, msg.PendingChannelID, err) f.failFundingFlow(peer, msg.PendingChannelID, err)
return return