• 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

41.67
/htlcswitch/failure_detail.go
1
package htlcswitch
2

3
// FailureDetail is an interface implemented by failures that occur on
4
// our incoming or outgoing link, or within the switch itself.
5
type FailureDetail interface {
6
        // FailureString returns the string representation of a failure
7
        // detail.
8
        FailureString() string
9
}
10

11
// OutgoingFailure is an enum which is used to enrich failures which occur in
12
// the switch or on our outgoing link with additional metadata.
13
type OutgoingFailure int
14

15
const (
16
        // OutgoingFailureNone is returned when the wire message contains
17
        // sufficient information.
18
        OutgoingFailureNone OutgoingFailure = iota
19

20
        // OutgoingFailureDecodeError indicates that we could not decode the
21
        // failure reason provided for a failed payment.
22
        OutgoingFailureDecodeError
23

24
        // OutgoingFailureLinkNotEligible indicates that a routing attempt was
25
        // made over a link that is not eligible for routing.
26
        OutgoingFailureLinkNotEligible
27

28
        // OutgoingFailureOnChainTimeout indicates that a payment had to be
29
        // timed out on chain before it got past the first hop by us or the
30
        // remote party.
31
        OutgoingFailureOnChainTimeout
32

33
        // OutgoingFailureHTLCExceedsMax is returned when a htlc exceeds our
34
        // policy's maximum htlc amount.
35
        OutgoingFailureHTLCExceedsMax
36

37
        // OutgoingFailureInsufficientBalance is returned when we cannot route a
38
        // htlc due to insufficient outgoing capacity.
39
        OutgoingFailureInsufficientBalance
40

41
        // OutgoingFailureCircularRoute is returned when an attempt is made
42
        // to forward a htlc through our node which arrives and leaves on the
43
        // same channel.
44
        OutgoingFailureCircularRoute
45

46
        // OutgoingFailureIncompleteForward is returned when we cancel an incomplete
47
        // forward.
48
        OutgoingFailureIncompleteForward
49

50
        // OutgoingFailureDownstreamHtlcAdd is returned when we fail to add a
51
        // downstream htlc to our outgoing link.
52
        OutgoingFailureDownstreamHtlcAdd
53

54
        // OutgoingFailureForwardsDisabled is returned when the switch is
55
        // configured to disallow forwards.
56
        OutgoingFailureForwardsDisabled
57
)
58

59
// FailureString returns the string representation of a failure detail.
60
//
61
// Note: it is part of the FailureDetail interface.
62
func (fd OutgoingFailure) FailureString() string {
3✔
63
        switch fd {
3✔
64
        case OutgoingFailureNone:
×
65
                return "no failure detail"
×
66

67
        case OutgoingFailureDecodeError:
×
68
                return "could not decode wire failure"
×
69

UNCOV
70
        case OutgoingFailureLinkNotEligible:
×
UNCOV
71
                return "link not eligible"
×
72

73
        case OutgoingFailureOnChainTimeout:
3✔
74
                return "payment was resolved on-chain, then canceled back"
3✔
75

76
        case OutgoingFailureHTLCExceedsMax:
3✔
77
                return "htlc exceeds maximum policy amount"
3✔
78

79
        case OutgoingFailureInsufficientBalance:
3✔
80
                return "insufficient bandwidth to route htlc"
3✔
81

UNCOV
82
        case OutgoingFailureCircularRoute:
×
UNCOV
83
                return "same incoming and outgoing channel"
×
84

UNCOV
85
        case OutgoingFailureIncompleteForward:
×
UNCOV
86
                return "failed after detecting incomplete forward"
×
87

88
        case OutgoingFailureDownstreamHtlcAdd:
×
89
                return "could not add downstream htlc"
×
90

91
        case OutgoingFailureForwardsDisabled:
3✔
92
                return "node configured to disallow forwards"
3✔
93

94
        default:
×
95
                return "unknown failure detail"
×
96
        }
97
}
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