routing: handle switch error when sendAttempt fails

This commit starts handling switch error inside `sendAttempt` when an
error is returned from sending the HTLC. To make sure the updated
`HTLCAttempt` is always returned to the callsite, `handleSwitchErr` now
also returns a `attemptResult`.
This commit is contained in:
yyforyongyu committed 2023-11-13 16:09:10 +08:00
1 parent 568b977a1f
commit 49bafc0207
2 files changed
+25 -18

No files matched your search

+1 -1
View File
@@ -2558,7 +2558,7 @@ func (r *ChannelRouter) sendToRoute(htlcHash lntypes.Hash, rt *route.Route,
// the error to check if it maps into a terminal error code, if not use
// a generic NO_ROUTE error.
var failureReason *channeldb.FailureReason
err = p.handleSwitchErr(attempt, shardError)
_, err = p.handleSwitchErr(attempt, shardError)
switch {
// If a non-terminal error is returned and `skipTempErr` is false, then