• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

lightningnetwork / lnd / 13566028875

27 Feb 2025 12:09PM UTC coverage: 49.396% (-9.4%) from 58.748%
13566028875

Pull #9555

github

ellemouton
graph/db: populate the graph cache in Start instead of during construction

In this commit, we move the graph cache population logic out of the
ChannelGraph constructor and into its Start method instead.
Pull Request #9555: graph: extract cache from CRUD [6]

34 of 54 new or added lines in 4 files covered. (62.96%)

27464 existing lines in 436 files now uncovered.

101095 of 204664 relevant lines covered (49.4%)

1.54 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/invoices/errors.go
1
package invoices
2

3
import (
4
        "errors"
5
        "fmt"
6
)
7

8
var (
9
        // ErrInvoiceAlreadySettled is returned when the invoice is already
10
        // settled.
11
        ErrInvoiceAlreadySettled = errors.New("invoice already settled")
12

13
        // ErrInvoiceAlreadyCanceled is returned when the invoice is already
14
        // canceled.
15
        ErrInvoiceAlreadyCanceled = errors.New("invoice already canceled")
16

17
        // ErrInvoiceAlreadyAccepted is returned when the invoice is already
18
        // accepted.
19
        ErrInvoiceAlreadyAccepted = errors.New("invoice already accepted")
20

21
        // ErrInvoiceStillOpen is returned when the invoice is still open.
22
        ErrInvoiceStillOpen = errors.New("invoice still open")
23

24
        // ErrInvoiceCannotOpen is returned when an attempt is made to move an
25
        // invoice to the open state.
26
        ErrInvoiceCannotOpen = errors.New("cannot move invoice to open")
27

28
        // ErrInvoiceCannotAccept is returned when an attempt is made to accept
29
        // an invoice while the invoice is not in the open state.
30
        ErrInvoiceCannotAccept = errors.New("cannot accept invoice")
31

32
        // ErrInvoicePreimageMismatch is returned when the preimage doesn't
33
        // match the invoice hash.
34
        ErrInvoicePreimageMismatch = errors.New("preimage does not match")
35

36
        // ErrHTLCPreimageMissing is returned when trying to accept/settle an
37
        // AMP HTLC but the HTLC-level preimage has not been set.
38
        ErrHTLCPreimageMissing = errors.New("AMP htlc missing preimage")
39

40
        // ErrHTLCPreimageMismatch is returned when trying to accept/settle an
41
        // AMP HTLC but the HTLC-level preimage does not satisfying the
42
        // HTLC-level payment hash.
43
        ErrHTLCPreimageMismatch = errors.New("htlc preimage mismatch")
44

45
        // ErrHTLCAlreadySettled is returned when trying to settle an invoice
46
        // but HTLC already exists in the settled state.
47
        ErrHTLCAlreadySettled = errors.New("htlc already settled")
48

49
        // ErrInvoiceHasHtlcs is returned when attempting to insert an invoice
50
        // that already has HTLCs.
51
        ErrInvoiceHasHtlcs = errors.New("cannot add invoice with htlcs")
52

53
        // ErrEmptyHTLCSet is returned when attempting to accept or settle and
54
        // HTLC set that has no HTLCs.
55
        ErrEmptyHTLCSet = errors.New("cannot settle/accept empty HTLC set")
56

57
        // ErrUnexpectedInvoicePreimage is returned when an invoice-level
58
        // preimage is provided when trying to settle an invoice that shouldn't
59
        // have one, e.g. an AMP invoice.
60
        ErrUnexpectedInvoicePreimage = errors.New(
61
                "unexpected invoice preimage provided on settle",
62
        )
63

64
        // ErrHTLCPreimageAlreadyExists is returned when trying to set an
65
        // htlc-level preimage but one is already known.
66
        ErrHTLCPreimageAlreadyExists = errors.New(
67
                "htlc-level preimage already exists",
68
        )
69

70
        // ErrInvoiceNotFound is returned when a targeted invoice can't be
71
        // found.
72
        ErrInvoiceNotFound = errors.New("unable to locate invoice")
73

74
        // ErrNoInvoicesCreated is returned when we don't have invoices in
75
        // our database to return.
76
        ErrNoInvoicesCreated = errors.New("there are no existing invoices")
77

78
        // ErrDuplicateInvoice is returned when an invoice with the target
79
        // payment hash already exists.
80
        ErrDuplicateInvoice = errors.New(
81
                "invoice with payment hash already exists",
82
        )
83

84
        // ErrDuplicatePayAddr is returned when an invoice with the target
85
        // payment addr already exists.
86
        ErrDuplicatePayAddr = errors.New(
87
                "invoice with payemnt addr already exists",
88
        )
89

90
        // ErrInvRefEquivocation is returned when an InvoiceRef targets
91
        // multiple, distinct invoices.
92
        ErrInvRefEquivocation = errors.New("inv ref matches multiple invoices")
93

94
        // ErrNoPaymentsCreated is returned when bucket of payments hasn't been
95
        // created.
96
        ErrNoPaymentsCreated = errors.New("there are no existing payments")
97
)
98

99
// ErrDuplicateSetID is an error returned when attempting to adding an AMP HTLC
100
// to an invoice, but another invoice is already indexed by the same set id.
101
type ErrDuplicateSetID struct {
102
        SetID [32]byte
103
}
104

105
// Error returns a human-readable description of ErrDuplicateSetID.
UNCOV
106
func (e ErrDuplicateSetID) Error() string {
×
UNCOV
107
        return fmt.Sprintf("invoice with set_id=%x already exists", e.SetID)
×
UNCOV
108
}
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc