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

lightningnetwork / lnd / 13211764208

08 Feb 2025 03:08AM UTC coverage: 49.288% (-9.5%) from 58.815%
13211764208

Pull #9489

github

calvinrzachman
itest: verify switchrpc server enforces send then track

We prevent the rpc server from allowing onion dispatches for
attempt IDs which have already been tracked by rpc clients.

This helps protect the client from leaking a duplicate onion
attempt. NOTE: This is not the only method for solving this
issue! The issue could be addressed via careful client side
programming which accounts for the uncertainty and async
nature of dispatching onions to a remote process via RPC.
This would require some lnd ChannelRouter changes for how
we intend to use these RPCs though.
Pull Request #9489: multi: add BuildOnion, SendOnion, and TrackOnion RPCs

474 of 990 new or added lines in 11 files covered. (47.88%)

27321 existing lines in 435 files now uncovered.

101192 of 205306 relevant lines covered (49.29%)

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

UNCOV
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