htlcswitch: change sendMalformedHTLCError to take array instead of slice

This commit is contained in:
Keagan McClelland 2024-08-20 11:01:34 -06:00 committed by Oliver Gugger
parent fb841b6436
commit e4497b4f45
No known key found for this signature in database
GPG key ID: 8E4256593F177720

View file

@ -3482,7 +3482,7 @@ func (l *channelLink) processRemoteAdds(fwdPkg *channeldb.FwdPkg,
// should send the malformed htlc error to payment // should send the malformed htlc error to payment
// sender. // sender.
l.sendMalformedHTLCError(pd.HtlcIndex, failureCode, l.sendMalformedHTLCError(pd.HtlcIndex, failureCode,
onionBlob[:], pd.SourceRef) pd.OnionBlob, pd.SourceRef)
l.log.Errorf("unable to decode onion hop "+ l.log.Errorf("unable to decode onion hop "+
"iterator: %v", failureCode) "iterator: %v", failureCode)
@ -3527,7 +3527,7 @@ func (l *channelLink) processRemoteAdds(fwdPkg *channeldb.FwdPkg,
// malformed. // malformed.
l.sendMalformedHTLCError( l.sendMalformedHTLCError(
pd.HtlcIndex, failureCode, pd.HtlcIndex, failureCode,
onionBlob[:], pd.SourceRef, pd.OnionBlob, pd.SourceRef,
) )
continue continue
@ -3561,7 +3561,7 @@ func (l *channelLink) processRemoteAdds(fwdPkg *channeldb.FwdPkg,
// should send the malformed htlc error to payment // should send the malformed htlc error to payment
// sender. // sender.
l.sendMalformedHTLCError( l.sendMalformedHTLCError(
pd.HtlcIndex, failureCode, onionBlob[:], pd.HtlcIndex, failureCode, pd.OnionBlob,
pd.SourceRef, pd.SourceRef,
) )
@ -4065,9 +4065,10 @@ func (l *channelLink) sendIncomingHTLCFailureMsg(htlcIndex uint64,
// sendMalformedHTLCError helper function which sends the malformed HTLC update // sendMalformedHTLCError helper function which sends the malformed HTLC update
// to the payment sender. // to the payment sender.
func (l *channelLink) sendMalformedHTLCError(htlcIndex uint64, func (l *channelLink) sendMalformedHTLCError(htlcIndex uint64,
code lnwire.FailCode, onionBlob []byte, sourceRef *channeldb.AddRef) { code lnwire.FailCode, onionBlob [lnwire.OnionPacketSize]byte,
sourceRef *channeldb.AddRef) {
shaOnionBlob := sha256.Sum256(onionBlob) shaOnionBlob := sha256.Sum256(onionBlob[:])
err := l.channel.MalformedFailHTLC(htlcIndex, code, shaOnionBlob, sourceRef) err := l.channel.MalformedFailHTLC(htlcIndex, code, shaOnionBlob, sourceRef)
if err != nil { if err != nil {
l.log.Errorf("unable cancel htlc: %v", err) l.log.Errorf("unable cancel htlc: %v", err)