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

lightningnetwork / lnd / 13536249039

26 Feb 2025 03:42AM UTC coverage: 57.462% (-1.4%) from 58.835%
13536249039

Pull #8453

github

Roasbeef
peer: update chooseDeliveryScript to gen script if needed

In this commit, we update `chooseDeliveryScript` to generate a new
script if needed. This allows us to fold in a few other lines that
always followed this function into this expanded function.

The tests have been updated accordingly.
Pull Request #8453: [4/4] - multi: integrate new rbf coop close FSM into the existing peer flow

275 of 1318 new or added lines in 22 files covered. (20.86%)

19521 existing lines in 257 files now uncovered.

103858 of 180741 relevant lines covered (57.46%)

24750.23 hits per line

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

78.95
/graph/errors.go
1
package graph
2

3
import "github.com/go-errors/errors"
4

5
// ErrorCode is used to represent the various errors that can occur within this
6
// package.
7
type ErrorCode uint8
8

9
const (
10
        // ErrOutdated is returned when the routing update already have
11
        // been applied, or a newer update is already known.
12
        ErrOutdated ErrorCode = iota
13

14
        // ErrIgnored is returned when the update have been ignored because
15
        // this update can't bring us something new, or because a node
16
        // announcement was given for node not found in any channel.
17
        ErrIgnored
18
)
19

20
// Error is a structure that represent the error inside the graph package,
21
// this structure carries additional information about error code in order to
22
// be able distinguish errors outside of the current package.
23
type Error struct {
24
        err  *errors.Error
25
        code ErrorCode
26
}
27

28
// Error represents errors as the string
29
// NOTE: Part of the error interface.
UNCOV
30
func (e *Error) Error() string {
×
UNCOV
31
        return e.err.Error()
×
UNCOV
32
}
×
33

34
// A compile time check to ensure Error implements the error interface.
35
var _ error = (*Error)(nil)
36

37
// NewErrf creates a Error by the given error formatted description and
38
// its corresponding error code.
39
func NewErrf(code ErrorCode, format string, a ...interface{}) *Error {
3✔
40
        return &Error{
3✔
41
                code: code,
3✔
42
                err:  errors.Errorf(format, a...),
3✔
43
        }
3✔
44
}
3✔
45

46
// IsError is a helper function which is needed to have ability to check that
47
// returned error has specific error code.
48
func IsError(e interface{}, codes ...ErrorCode) bool {
5✔
49
        err, ok := e.(*Error)
5✔
50
        if !ok {
6✔
51
                return false
1✔
52
        }
1✔
53

54
        for _, code := range codes {
8✔
55
                if err.code == code {
8✔
56
                        return true
4✔
57
                }
4✔
58
        }
59

60
        return false
×
61
}
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