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

lightningnetwork / lnd / 13233514377

10 Feb 2025 04:24AM UTC coverage: 49.335% (-9.5%) from 58.815%
13233514377

Pull #9492

github

yyforyongyu
itest: fix flake in `testForwardInterceptorRestart`

We need to make sure the links are recreated before calling the
interceptor, otherwise we'd get the following error, causing the test to
fail.
```
2025-02-07 15:01:38.991 [ERR] RPCS interceptor.go:624: [/routerrpc.Router/HtlcInterceptor]: fwd (Chan ID=487:3:0, HTLC ID=0) not found
```
Pull Request #9492: itest: fix flake in `testForwardInterceptorRestart`

100803 of 204322 relevant lines covered (49.34%)

1.54 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
// 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
        // ErrChannelSpent is returned when we go to validate a channel, but
20
        // the purported funding output has actually already been spent on
21
        // chain.
22
        ErrChannelSpent
23

24
        // ErrNoFundingTransaction is returned when we are unable to find the
25
        // funding transaction described by the short channel ID on chain.
26
        ErrNoFundingTransaction
27

28
        // ErrInvalidFundingOutput is returned if the channel funding output
29
        // fails validation.
30
        ErrInvalidFundingOutput
31
)
32

33
// Error is a structure that represent the error inside the graph package,
34
// this structure carries additional information about error code in order to
35
// be able distinguish errors outside of the current package.
36
type Error struct {
37
        err  *errors.Error
38
        code ErrorCode
39
}
40

41
// Error represents errors as the string
42
// NOTE: Part of the error interface.
43
func (e *Error) Error() string {
3✔
44
        return e.err.Error()
3✔
45
}
3✔
46

47
// A compile time check to ensure Error implements the error interface.
48
var _ error = (*Error)(nil)
49

50
// NewErrf creates a Error by the given error formatted description and
51
// its corresponding error code.
52
func NewErrf(code ErrorCode, format string, a ...interface{}) *Error {
3✔
53
        return &Error{
3✔
54
                code: code,
3✔
55
                err:  errors.Errorf(format, a...),
3✔
56
        }
3✔
57
}
3✔
58

59
// IsError is a helper function which is needed to have ability to check that
60
// returned error has specific error code.
61
func IsError(e interface{}, codes ...ErrorCode) bool {
3✔
62
        err, ok := e.(*Error)
3✔
63
        if !ok {
6✔
64
                return false
3✔
65
        }
3✔
66

67
        for _, code := range codes {
6✔
68
                if err.code == code {
6✔
69
                        return true
3✔
70
                }
3✔
71
        }
72

73
        return false
×
74
}
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