Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

accounts: don't error out on payment not initiated #640

Merged
merged 1 commit into from
Sep 6, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions accounts/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@ package accounts

import (
"context"
"errors"
"fmt"
"sync"
"time"

"github.com/btcsuite/btcd/chaincfg"
"github.com/lightninglabs/lndclient"
"github.com/lightningnetwork/lnd/channeldb"
invpkg "github.com/lightningnetwork/lnd/invoices"
"github.com/lightningnetwork/lnd/lnrpc"
"github.com/lightningnetwork/lnd/lntypes"
Expand Down Expand Up @@ -501,6 +503,22 @@ func (s *InterceptorService) TrackPayment(id AccountID, hash lntypes.Hash,
}

case err := <-errChan:
// If the payment wasn't initiated, we can't
// track it really. We'll try again on next
// startup, to make sure we don't miss any
// payments.
if errors.Is(
err, channeldb.ErrPaymentNotInitiated,
) {
log.Debugf("Payment %v not initiated, "+
"stopping tracking", hash)

return
}

log.Errorf("Received error from TrackPayment "+
"RPC for payment %v: %v", hash, err)

if err != nil {
select {
case s.mainErrChan <- err:
Expand Down