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

lightningnetwork / lnd / 13154384907

05 Feb 2025 09:36AM UTC coverage: 58.809% (+0.01%) from 58.798%
13154384907

Pull #9477

github

ellemouton
docs: update release notes
Pull Request #9477: discovery+graph: various preparations for moving funding tx validation to the gossiper

6 of 17 new or added lines in 3 files covered. (35.29%)

28 existing lines in 10 files now uncovered.

136180 of 231564 relevant lines covered (58.81%)

19327.16 hits per line

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

94.74
/graph/errors.go
1
package graph
2

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

5
var (
6
        // ErrNoFundingTransaction is returned when we are unable to find the
7
        // funding transaction described by the short channel ID on chain.
8
        ErrNoFundingTransaction = errors.New(
9
                "unable to find the funding transaction",
10
        )
11

12
        // ErrInvalidFundingOutput is returned if the channel funding output
13
        // fails validation.
14
        ErrInvalidFundingOutput = errors.New(
15
                "channel funding output validation failed",
16
        )
17

18
        // ErrChannelSpent is returned when we go to validate a channel, but
19
        // the purported funding output has actually already been spent on
20
        // chain.
21
        ErrChannelSpent = errors.New("channel output has been spent")
22
)
23

24
// ErrorCode is used to represent the various errors that can occur within this
25
// package.
26
type ErrorCode uint8
27

28
const (
29
        // ErrOutdated is returned when the routing update already have
30
        // been applied, or a newer update is already known.
31
        ErrOutdated ErrorCode = iota
32

33
        // ErrIgnored is returned when the update have been ignored because
34
        // this update can't bring us something new, or because a node
35
        // announcement was given for node not found in any channel.
36
        ErrIgnored
37
)
38

39
// Error is a structure that represent the error inside the graph package,
40
// this structure carries additional information about error code in order to
41
// be able distinguish errors outside of the current package.
42
type Error struct {
43
        err  *errors.Error
44
        code ErrorCode
45
}
46

47
// Error represents errors as the string
48
// NOTE: Part of the error interface.
49
func (e *Error) Error() string {
3✔
50
        return e.err.Error()
3✔
51
}
3✔
52

53
// A compile time check to ensure Error implements the error interface.
54
var _ error = (*Error)(nil)
55

56
// NewErrf creates a Error by the given error formatted description and
57
// its corresponding error code.
58
func NewErrf(code ErrorCode, format string, a ...interface{}) *Error {
6✔
59
        return &Error{
6✔
60
                code: code,
6✔
61
                err:  errors.Errorf(format, a...),
6✔
62
        }
6✔
63
}
6✔
64

65
// IsError is a helper function which is needed to have ability to check that
66
// returned error has specific error code.
67
func IsError(e interface{}, codes ...ErrorCode) bool {
212✔
68
        err, ok := e.(*Error)
212✔
69
        if !ok {
420✔
70
                return false
208✔
71
        }
208✔
72

73
        for _, code := range codes {
14✔
74
                if err.code == code {
14✔
75
                        return true
7✔
76
                }
7✔
77
        }
78

UNCOV
79
        return false
×
80
}
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