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 2023-01-16 13:50:26 -06:00
parent ec85b5be72
commit e59cd7f91d
No known key found for this signature in database
GPG Key ID: CC8ECA224831C982
2 changed files with 5 additions and 5 deletions

View File

@ -38,10 +38,10 @@ func negotiateCommitmentType(desiredChanType *lnwire.ChannelType, local,
local, remote, lnwire.ExplicitChannelTypeOptional,
) {
chanType, err := explicitNegotiateCommitmentType(
commitType, err := explicitNegotiateCommitmentType(
*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

View File

@ -1883,14 +1883,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(
_, implicitCommitType := 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(
_, _, negotiatedCommitType, err := negotiateCommitmentType(
msg.ChannelType, peer.LocalFeatures(),
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
// same type we'd have arrived through implicit negotiation. If
// it's another type, we fail the flow.
if implicitChannelType != negotiatedChannelType {
if implicitCommitType != negotiatedCommitType {
err := errors.New("negotiated unexpected channel type")
f.failFundingFlow(peer, msg.PendingChannelID, err)
return