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

lightningnetwork / lnd / 13440912774

20 Feb 2025 05:14PM UTC coverage: 57.697% (-1.1%) from 58.802%
13440912774

Pull #9535

github

guggero
GitHub: remove duplicate caching

Turns out that actions/setup-go starting with @v4 also adds caching.
With that, our cache size on disk has almost doubled, leading to the
GitHub runner running out of space in certain situation.
We fix that by disabling the automated caching since we already have our
own, custom-tailored version.
Pull Request #9535: GitHub: remove duplicate caching

103519 of 179417 relevant lines covered (57.7%)

24825.3 hits per line

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

40.0
/lnwallet/errors.go
1
package lnwallet
2

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

7
        "github.com/btcsuite/btcd/btcutil"
8
        "github.com/btcsuite/btcd/chaincfg/chainhash"
9
        "github.com/lightningnetwork/lnd/lnwire"
10
)
11

12
// ReservationError wraps certain errors returned during channel reservation
13
// that can be sent across the wire to the remote peer. Errors not being
14
// ReservationErrors will not be sent to the remote in case of a failed channel
15
// reservation, as they may contain private information.
16
type ReservationError struct {
17
        error
18
}
19

20
// A compile time check to ensure ReservationError implements the error
21
// interface.
22
var _ error = (*ReservationError)(nil)
23

24
// ErrZeroCapacity returns an error indicating the funder attempted to put zero
25
// funds into the channel.
26
func ErrZeroCapacity() ReservationError {
×
27
        return ReservationError{
×
28
                errors.New("zero channel funds"),
×
29
        }
×
30
}
×
31

32
// ErrChainMismatch returns an error indicating that the initiator tried to
33
// open a channel for an unknown chain.
34
func ErrChainMismatch(knownChain,
35
        unknownChain *chainhash.Hash) ReservationError {
×
36
        return ReservationError{
×
37
                fmt.Errorf("unknown chain=%v, supported chain=%v",
×
38
                        unknownChain, knownChain),
×
39
        }
×
40
}
×
41

42
// ErrFunderBalanceDust returns an error indicating the initial balance of the
43
// funder is considered dust at the current commitment fee.
44
func ErrFunderBalanceDust(commitFee, funderBalance,
45
        minBalance int64) ReservationError {
4✔
46
        return ReservationError{
4✔
47
                fmt.Errorf("funder balance too small (%v) with fee=%v sat, "+
4✔
48
                        "minimum=%v sat required", funderBalance,
4✔
49
                        commitFee, minBalance),
4✔
50
        }
4✔
51
}
4✔
52

53
// ErrCsvDelayTooLarge returns an error indicating that the CSV delay was to
54
// large to be accepted, along with the current max.
55
func ErrCsvDelayTooLarge(remoteDelay, maxDelay uint16) ReservationError {
2✔
56
        return ReservationError{
2✔
57
                fmt.Errorf("CSV delay too large: %v, max is %v",
2✔
58
                        remoteDelay, maxDelay),
2✔
59
        }
2✔
60
}
2✔
61

62
// ErrChanReserveTooSmall returns an error indicating that the channel reserve
63
// the remote is requiring is too small to be accepted.
64
func ErrChanReserveTooSmall(reserve, dustLimit btcutil.Amount) ReservationError {
1✔
65
        return ReservationError{
1✔
66
                fmt.Errorf("channel reserve of %v sat is too small, min is %v "+
1✔
67
                        "sat", int64(reserve), int64(dustLimit)),
1✔
68
        }
1✔
69
}
1✔
70

71
// ErrChanReserveTooLarge returns an error indicating that the chan reserve the
72
// remote is requiring, is too large to be accepted.
73
func ErrChanReserveTooLarge(reserve,
74
        maxReserve btcutil.Amount) ReservationError {
1✔
75
        return ReservationError{
1✔
76
                fmt.Errorf("channel reserve is too large: %v sat, max "+
1✔
77
                        "is %v sat", int64(reserve), int64(maxReserve)),
1✔
78
        }
1✔
79
}
1✔
80

81
// ErrNonZeroPushAmount is returned by a remote peer that receives a
82
// FundingOpen request for a channel with non-zero push amount while
83
// they have 'rejectpush' enabled.
84
func ErrNonZeroPushAmount() ReservationError {
1✔
85
        return ReservationError{errors.New("non-zero push amounts are disabled")}
1✔
86
}
1✔
87

88
// ErrMinHtlcTooLarge returns an error indicating that the MinHTLC value the
89
// remote required is too large to be accepted.
90
func ErrMinHtlcTooLarge(minHtlc,
91
        maxMinHtlc lnwire.MilliSatoshi) ReservationError {
×
92
        return ReservationError{
×
93
                fmt.Errorf("minimum HTLC value is too large: %v, max is %v",
×
94
                        minHtlc, maxMinHtlc),
×
95
        }
×
96
}
×
97

98
// ErrMaxHtlcNumTooLarge returns an error indicating that the 'max HTLCs in
99
// flight' value the remote required is too large to be accepted.
100
func ErrMaxHtlcNumTooLarge(maxHtlc, maxMaxHtlc uint16) ReservationError {
×
101
        return ReservationError{
×
102
                fmt.Errorf("maxHtlcs is too large: %d, max is %d",
×
103
                        maxHtlc, maxMaxHtlc),
×
104
        }
×
105
}
×
106

107
// ErrMaxHtlcNumTooSmall returns an error indicating that the 'max HTLCs in
108
// flight' value the remote required is too small to be accepted.
109
func ErrMaxHtlcNumTooSmall(maxHtlc, minMaxHtlc uint16) ReservationError {
×
110
        return ReservationError{
×
111
                fmt.Errorf("maxHtlcs is too small: %d, min is %d",
×
112
                        maxHtlc, minMaxHtlc),
×
113
        }
×
114
}
×
115

116
// ErrMaxValueInFlightTooSmall returns an error indicating that the 'max HTLC
117
// value in flight' the remote required is too small to be accepted.
118
func ErrMaxValueInFlightTooSmall(maxValInFlight,
119
        minMaxValInFlight lnwire.MilliSatoshi) ReservationError {
×
120
        return ReservationError{
×
121
                fmt.Errorf("maxValueInFlight too small: %v, min is %v",
×
122
                        maxValInFlight, minMaxValInFlight),
×
123
        }
×
124
}
×
125

126
// ErrNumConfsTooLarge returns an error indicating that the number of
127
// confirmations required for a channel is too large.
128
func ErrNumConfsTooLarge(numConfs, maxNumConfs uint32) error {
1✔
129
        return ReservationError{
1✔
130
                fmt.Errorf("minimum depth of %d is too large, max is %d",
1✔
131
                        numConfs, maxNumConfs),
1✔
132
        }
1✔
133
}
1✔
134

135
// ErrChanTooSmall returns an error indicating that an incoming channel request
136
// was too small. We'll reject any incoming channels if they're below our
137
// configured value for the min channel size we'll accept.
138
func ErrChanTooSmall(chanSize, minChanSize btcutil.Amount) ReservationError {
×
139
        return ReservationError{
×
140
                fmt.Errorf("chan size of %v is below min chan size of %v",
×
141
                        chanSize, minChanSize),
×
142
        }
×
143
}
×
144

145
// ErrChanTooLarge returns an error indicating that an incoming channel request
146
// was too large. We'll reject any incoming channels if they're above our
147
// configured value for the max channel size we'll accept.
148
func ErrChanTooLarge(chanSize, maxChanSize btcutil.Amount) ReservationError {
2✔
149
        return ReservationError{
2✔
150
                fmt.Errorf("chan size of %v exceeds maximum chan size of %v",
2✔
151
                        chanSize, maxChanSize),
2✔
152
        }
2✔
153
}
2✔
154

155
// ErrInvalidDustLimit returns an error indicating that a proposed DustLimit
156
// was rejected.
157
func ErrInvalidDustLimit(dustLimit btcutil.Amount) ReservationError {
×
158
        return ReservationError{
×
159
                fmt.Errorf("dust limit %v is invalid", dustLimit),
×
160
        }
×
161
}
×
162

163
// ErrHtlcIndexAlreadyFailed is returned when the HTLC index has already been
164
// failed, but has not been committed by our commitment state.
165
type ErrHtlcIndexAlreadyFailed uint64
166

167
// Error returns a message indicating the index that had already been failed.
168
func (e ErrHtlcIndexAlreadyFailed) Error() string {
×
169
        return fmt.Sprintf("HTLC with ID %d has already been failed", e)
×
170
}
×
171

172
// ErrHtlcIndexAlreadySettled is returned when the HTLC index has already been
173
// settled, but has not been committed by our commitment state.
174
type ErrHtlcIndexAlreadySettled uint64
175

176
// Error returns a message indicating the index that had already been settled.
177
func (e ErrHtlcIndexAlreadySettled) Error() string {
×
178
        return fmt.Sprintf("HTLC with ID %d has already been settled", e)
×
179
}
×
180

181
// ErrInvalidSettlePreimage is returned when trying to settle an HTLC, but the
182
// preimage does not correspond to the payment hash.
183
type ErrInvalidSettlePreimage struct {
184
        preimage []byte
185
        rhash    []byte
186
}
187

188
// Error returns an error message with the offending preimage and intended
189
// payment hash.
190
func (e ErrInvalidSettlePreimage) Error() string {
×
191
        return fmt.Sprintf("Invalid payment preimage %x for hash %x",
×
192
                e.preimage, e.rhash)
×
193
}
×
194

195
// ErrUnknownHtlcIndex is returned when locally settling or failing an HTLC, but
196
// the HTLC index is not known to the channel. This typically indicates that the
197
// HTLC was already settled in a prior commitment.
198
type ErrUnknownHtlcIndex struct {
199
        chanID lnwire.ShortChannelID
200
        index  uint64
201
}
202

203
// Error returns an error logging the channel and HTLC index that was unknown.
204
func (e ErrUnknownHtlcIndex) Error() string {
×
205
        return fmt.Sprintf("No HTLC with ID %d in channel %v",
×
206
                e.index, e.chanID)
×
207
}
×
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