switch: add trace log for circular route detection

Helps with debugging of strict forwarding issues.
This commit is contained in:
Oliver Gugger 2025-04-17 10:51:57 +02:00
parent 24fdae7dff
commit cf0e0ff32c
No known key found for this signature in database
GPG Key ID: 8E4256593F177720

View File

@ -1149,6 +1149,9 @@ func (s *Switch) handlePacketForward(packet *htlcPacket) error {
func (s *Switch) checkCircularForward(incoming, outgoing lnwire.ShortChannelID,
allowCircular bool, paymentHash lntypes.Hash) *LinkError {
log.Tracef("Checking for circular route: incoming=%v, outgoing=%v "+
"(payment hash: %x)", incoming, outgoing, paymentHash[:])
// If they are equal, we can skip the alias mapping checks.
if incoming == outgoing {
// The switch may be configured to allow circular routes, so
@ -1189,6 +1192,10 @@ func (s *Switch) checkCircularForward(incoming, outgoing lnwire.ShortChannelID,
// Check base SCID equality.
if incomingBaseScid != outgoingBaseScid {
log.Tracef("Incoming base SCID %v does not match outgoing "+
"base SCID %v (payment hash: %x)", incomingBaseScid,
outgoingBaseScid, paymentHash[:])
// The base SCIDs are not equal so these are not the same
// channel.
return nil