Skip to content

Commit dfb4fff

Browse files
authored
Merge pull request #640 from lightninglabs/fix-payment-not-initiated
accounts: don't error out on payment not initiated
2 parents a942af6 + fd6c906 commit dfb4fff

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

accounts/service.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,14 @@ package accounts
22

33
import (
44
"context"
5+
"errors"
56
"fmt"
67
"sync"
78
"time"
89

910
"github.com/btcsuite/btcd/chaincfg"
1011
"github.com/lightninglabs/lndclient"
12+
"github.com/lightningnetwork/lnd/channeldb"
1113
invpkg "github.com/lightningnetwork/lnd/invoices"
1214
"github.com/lightningnetwork/lnd/lnrpc"
1315
"github.com/lightningnetwork/lnd/lntypes"
@@ -501,6 +503,22 @@ func (s *InterceptorService) TrackPayment(id AccountID, hash lntypes.Hash,
501503
}
502504

503505
case err := <-errChan:
506+
// If the payment wasn't initiated, we can't
507+
// track it really. We'll try again on next
508+
// startup, to make sure we don't miss any
509+
// payments.
510+
if errors.Is(
511+
err, channeldb.ErrPaymentNotInitiated,
512+
) {
513+
log.Debugf("Payment %v not initiated, "+
514+
"stopping tracking", hash)
515+
516+
return
517+
}
518+
519+
log.Errorf("Received error from TrackPayment "+
520+
"RPC for payment %v: %v", hash, err)
521+
504522
if err != nil {
505523
select {
506524
case s.mainErrChan <- err:

0 commit comments

Comments
 (0)