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

lightningnetwork / lnd / 17011395530

16 Aug 2025 06:08PM UTC coverage: 57.298% (-9.5%) from 66.765%
17011395530

Pull #10167

github

web-flow
Merge 3c250722d into fb1adfc21
Pull Request #10167: multi: bump Go to 1.24.6

99112 of 172975 relevant lines covered (57.3%)

1.78 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
        // ErrInvoiceNotCanceled is returned when the invoice is not canceled.
18
        ErrInvoiceNotCanceled = errors.New("invoice not canceled")
19

20
        // ErrInvoiceAlreadyAccepted is returned when the invoice is already
21
        // accepted.
22
        ErrInvoiceAlreadyAccepted = errors.New("invoice already accepted")
23

24
        // ErrInvoiceStillOpen is returned when the invoice is still open.
25
        ErrInvoiceStillOpen = errors.New("invoice still open")
26

27
        // ErrInvoiceCannotOpen is returned when an attempt is made to move an
28
        // invoice to the open state.
29
        ErrInvoiceCannotOpen = errors.New("cannot move invoice to open")
30

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

35
        // ErrInvoicePreimageMismatch is returned when the preimage doesn't
36
        // match the invoice hash.
37
        ErrInvoicePreimageMismatch = errors.New("preimage does not match")
38

39
        // ErrNoInvoiceHash is returned when an invoice hash is expected, and
40
        // none is provided.
41
        ErrNoInvoiceHash = errors.New("invoice hash must be provided")
42

43
        // ErrHTLCPreimageMissing is returned when trying to accept/settle an
44
        // AMP HTLC but the HTLC-level preimage has not been set.
45
        ErrHTLCPreimageMissing = errors.New("AMP htlc missing preimage")
46

47
        // ErrHTLCPreimageMismatch is returned when trying to accept/settle an
48
        // AMP HTLC but the HTLC-level preimage does not satisfying the
49
        // HTLC-level payment hash.
50
        ErrHTLCPreimageMismatch = errors.New("htlc preimage mismatch")
51

52
        // ErrHTLCAlreadySettled is returned when trying to settle an invoice
53
        // but HTLC already exists in the settled state.
54
        ErrHTLCAlreadySettled = errors.New("htlc already settled")
55

56
        // ErrInvoiceHasHtlcs is returned when attempting to insert an invoice
57
        // that already has HTLCs.
58
        ErrInvoiceHasHtlcs = errors.New("cannot add invoice with htlcs")
59

60
        // ErrEmptyHTLCSet is returned when attempting to accept or settle and
61
        // HTLC set that has no HTLCs.
62
        ErrEmptyHTLCSet = errors.New("cannot settle/accept empty HTLC set")
63

64
        // ErrUnexpectedInvoicePreimage is returned when an invoice-level
65
        // preimage is provided when trying to settle an invoice that shouldn't
66
        // have one, e.g. an AMP invoice.
67
        ErrUnexpectedInvoicePreimage = errors.New(
68
                "unexpected invoice preimage provided on settle",
69
        )
70

71
        // ErrHTLCPreimageAlreadyExists is returned when trying to set an
72
        // htlc-level preimage but one is already known.
73
        ErrHTLCPreimageAlreadyExists = errors.New(
74
                "htlc-level preimage already exists",
75
        )
76

77
        // ErrInvoiceNotFound is returned when a targeted invoice can't be
78
        // found.
79
        ErrInvoiceNotFound = errors.New("unable to locate invoice")
80

81
        // ErrNoInvoicesCreated is returned when we don't have invoices in
82
        // our database to return.
83
        ErrNoInvoicesCreated = errors.New("there are no existing invoices")
84

85
        // ErrDuplicateInvoice is returned when an invoice with the target
86
        // payment hash already exists.
87
        ErrDuplicateInvoice = errors.New(
88
                "invoice with payment hash already exists",
89
        )
90

91
        // ErrDuplicatePayAddr is returned when an invoice with the target
92
        // payment addr already exists.
93
        ErrDuplicatePayAddr = errors.New(
94
                "invoice with payemnt addr already exists",
95
        )
96

97
        // ErrInvRefEquivocation is returned when an InvoiceRef targets
98
        // multiple, distinct invoices.
99
        ErrInvRefEquivocation = errors.New("inv ref matches multiple invoices")
100

101
        // ErrNoPaymentsCreated is returned when bucket of payments hasn't been
102
        // created.
103
        ErrNoPaymentsCreated = errors.New("there are no existing payments")
104
)
105

106
// ErrDuplicateSetID is an error returned when attempting to adding an AMP HTLC
107
// to an invoice, but another invoice is already indexed by the same set id.
108
type ErrDuplicateSetID struct {
109
        SetID [32]byte
110
}
111

112
// Error returns a human-readable description of ErrDuplicateSetID.
113
func (e ErrDuplicateSetID) Error() string {
×
114
        return fmt.Sprintf("invoice with set_id=%x already exists", e.SetID)
×
115
}
×
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