From 7e4f3d3b1dc9881b4c040c2b31b3cb9016d65edc Mon Sep 17 00:00:00 2001 From: Carla Kirk-Cohen Date: Wed, 3 Apr 2024 08:58:53 -0400 Subject: [PATCH] htlcswitch: reject HTLCs that use use as introduction if disabled Reject any HTLCs that use us as an introduction point in a blinded route if we have disabled route blinding. We have to do this after we've processed the payload, because we only know we're an introduction point once we've processed the payload itself. --- htlcswitch/link.go | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/htlcswitch/link.go b/htlcswitch/link.go index 45b9a8729..778e78d70 100644 --- a/htlcswitch/link.go +++ b/htlcswitch/link.go @@ -3309,6 +3309,27 @@ func (l *channelLink) processRemoteAdds(fwdPkg *channeldb.FwdPkg, fwdInfo := pld.ForwardingInfo() + // Check whether the payload we've just processed uses our + // node as the introduction point (gave us a blinding key in + // the payload itself) and fail it back if we don't support + // route blinding. + if fwdInfo.NextBlinding.IsSome() && + l.cfg.DisallowRouteBlinding { + + failure := lnwire.NewInvalidBlinding( + onionBlob[:], + ) + l.sendHTLCError( + pd, NewLinkError(failure), obfuscator, false, + ) + + l.log.Error("rejected htlc that uses use as an " + + "introduction point when we do not support " + + "route blinding") + + continue + } + switch fwdInfo.NextHop { case hop.Exit: err := l.processExitHop(