routing: use shardHandler to process err in SendToRoute

This commit is contained in:
yyforyongyu 2021-04-14 20:03:36 +08:00
parent 54aacacc11
commit 1656611358
No known key found for this signature in database
GPG Key ID: 9BCD95C4FF296868

@ -2163,15 +2163,13 @@ func (r *ChannelRouter) SendToRoute(htlcHash lntypes.Hash, rt *route.Route) (
// mark the payment failed with the control tower immediately. Process
// the error to check if it maps into a terminal error code, if not use
// a generic NO_ROUTE error.
reason := r.processSendError(
attempt.AttemptID, &attempt.Route, shardError,
)
if reason == nil {
r := channeldb.FailureReasonNoRoute
reason = &r
if err := sh.handleSendError(attempt, shardError); err != nil {
return nil, err
}
err = r.cfg.Control.Fail(paymentIdentifier, *reason)
err = r.cfg.Control.Fail(
paymentIdentifier, channeldb.FailureReasonNoRoute,
)
if err != nil {
return nil, err
}