channeldb+router: record payment failure reason in db

This commit is contained in:
Johan T. Halseth committed 2019-05-27 20:18:59 +02:00
1 parent 60e2367973
commit 1b788904f0
5 files changed
+106 -23

No files matched your search

+3 -3
View File
@@ -177,7 +177,7 @@ func (p *paymentLifecycle) createNewPaymentAttempt() (lnwire.ShortChannelID,
// Mark the payment as failed because of the
// timeout.
err := p.router.cfg.Control.Fail(
p.payment.PaymentHash,
p.payment.PaymentHash, channeldb.FailureReasonTimeout,
)
if err != nil {
return lnwire.ShortChannelID{}, nil, err
@@ -208,7 +208,7 @@ func (p *paymentLifecycle) createNewPaymentAttempt() (lnwire.ShortChannelID,
// any of the routes we've found, then mark the payment
// as permanently failed.
saveErr := p.router.cfg.Control.Fail(
p.payment.PaymentHash,
p.payment.PaymentHash, channeldb.FailureReasonNoRoute,
)
if saveErr != nil {
return lnwire.ShortChannelID{}, nil, saveErr
@@ -338,7 +338,7 @@ func (p *paymentLifecycle) handleSendError(sendErr error) error {
// TODO(halseth): make payment codes for the actual reason we
// don't continue path finding.
err := p.router.cfg.Control.Fail(
p.payment.PaymentHash,
p.payment.PaymentHash, channeldb.FailureReasonNoRoute,
)
if err != nil {
return err