mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-07-09 23:12:33 +02:00
routing: convert to nillable failure reason
This commit converts several functions from returning a bool and a failure reason to a nillable failure reason as return parameter. This will take away confusion about the interpretation of the two separate values.
This commit is contained in:
@ -342,10 +342,10 @@ func (p *paymentLifecycle) sendPaymentAttempt(firstHop lnwire.ShortChannelID,
|
||||
// whether we should make another payment attempt.
|
||||
func (p *paymentLifecycle) handleSendError(sendErr error) error {
|
||||
|
||||
final, reason := p.router.processSendError(
|
||||
reason := p.router.processSendError(
|
||||
p.attempt.PaymentID, &p.attempt.Route, sendErr,
|
||||
)
|
||||
if !final {
|
||||
if reason == nil {
|
||||
// Save the forwarding error so it can be returned if
|
||||
// this turns out to be the last attempt.
|
||||
p.lastError = sendErr
|
||||
@ -354,14 +354,14 @@ func (p *paymentLifecycle) handleSendError(sendErr error) error {
|
||||
}
|
||||
|
||||
log.Debugf("Payment %x failed: final_outcome=%v, raw_err=%v",
|
||||
p.payment.PaymentHash, reason, sendErr)
|
||||
p.payment.PaymentHash, *reason, sendErr)
|
||||
|
||||
// Mark the payment failed with no route.
|
||||
//
|
||||
// TODO(halseth): make payment codes for the actual reason we don't
|
||||
// continue path finding.
|
||||
err := p.router.cfg.Control.Fail(
|
||||
p.payment.PaymentHash, reason,
|
||||
p.payment.PaymentHash, *reason,
|
||||
)
|
||||
if err != nil {
|
||||
return err
|
||||
|
Reference in New Issue
Block a user