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

lightningnetwork / lnd / 13566028875

27 Feb 2025 12:09PM UTC coverage: 49.396% (-9.4%) from 58.748%
13566028875

Pull #9555

github

ellemouton
graph/db: populate the graph cache in Start instead of during construction

In this commit, we move the graph cache population logic out of the
ChannelGraph constructor and into its Start method instead.
Pull Request #9555: graph: extract cache from CRUD [6]

34 of 54 new or added lines in 4 files covered. (62.96%)

27464 existing lines in 436 files now uncovered.

101095 of 204664 relevant lines covered (49.4%)

1.54 hits per line

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

0.0
/channeldb/migration/lnwire21/update_fail_htlc.go
1
package lnwire
2

3
import (
4
        "io"
5
)
6

7
// OpaqueReason is an opaque encrypted byte slice that encodes the exact
8
// failure reason and additional some supplemental data. The contents of this
9
// slice can only be decrypted by the sender of the original HTLC.
10
type OpaqueReason []byte
11

12
// UpdateFailHTLC is sent by Alice to Bob in order to remove a previously added
13
// HTLC. Upon receipt of an UpdateFailHTLC the HTLC should be removed from the
14
// next commitment transaction, with the UpdateFailHTLC propagated backwards in
15
// the route to fully undo the HTLC.
16
type UpdateFailHTLC struct {
17
        // ChanID is the particular active channel that this
18
        // UpdateFailHTLC is bound to.
19
        ChanID ChannelID
20

21
        // ID references which HTLC on the remote node's commitment transaction
22
        // has timed out.
23
        ID uint64
24

25
        // Reason is an onion-encrypted blob that details why the HTLC was
26
        // failed. This blob is only fully decryptable by the initiator of the
27
        // HTLC message.
28
        Reason OpaqueReason
29
}
30

31
// A compile time check to ensure UpdateFailHTLC implements the lnwire.Message
32
// interface.
33
var _ Message = (*UpdateFailHTLC)(nil)
34

35
// Decode deserializes a serialized UpdateFailHTLC message stored in the passed
36
// io.Reader observing the specified protocol version.
37
//
38
// This is part of the lnwire.Message interface.
UNCOV
39
func (c *UpdateFailHTLC) Decode(r io.Reader, pver uint32) error {
×
UNCOV
40
        return ReadElements(r,
×
UNCOV
41
                &c.ChanID,
×
UNCOV
42
                &c.ID,
×
UNCOV
43
                &c.Reason,
×
UNCOV
44
        )
×
UNCOV
45
}
×
46

47
// Encode serializes the target UpdateFailHTLC into the passed io.Writer observing
48
// the protocol version specified.
49
//
50
// This is part of the lnwire.Message interface.
UNCOV
51
func (c *UpdateFailHTLC) Encode(w io.Writer, pver uint32) error {
×
UNCOV
52
        return WriteElements(w,
×
UNCOV
53
                c.ChanID,
×
UNCOV
54
                c.ID,
×
UNCOV
55
                c.Reason,
×
UNCOV
56
        )
×
UNCOV
57
}
×
58

59
// MsgType returns the integer uniquely identifying this message type on the
60
// wire.
61
//
62
// This is part of the lnwire.Message interface.
UNCOV
63
func (c *UpdateFailHTLC) MsgType() MessageType {
×
UNCOV
64
        return MsgUpdateFailHTLC
×
UNCOV
65
}
×
66

67
// MaxPayloadLength returns the maximum allowed payload size for an UpdateFailHTLC
68
// complete message observing the specified protocol version.
69
//
70
// This is part of the lnwire.Message interface.
UNCOV
71
func (c *UpdateFailHTLC) MaxPayloadLength(uint32) uint32 {
×
UNCOV
72
        var length uint32
×
UNCOV
73

×
UNCOV
74
        // Length of the ChanID
×
UNCOV
75
        length += 32
×
UNCOV
76

×
UNCOV
77
        // Length of the ID
×
UNCOV
78
        length += 8
×
UNCOV
79

×
UNCOV
80
        // Length of the length opaque reason
×
UNCOV
81
        length += 2
×
UNCOV
82

×
UNCOV
83
        // Length of the Reason
×
UNCOV
84
        length += 292
×
UNCOV
85

×
UNCOV
86
        return length
×
UNCOV
87
}
×
88

89
// TargetChanID returns the channel id of the link for which this message is
90
// intended.
91
//
92
// NOTE: Part of peer.LinkUpdater interface.
93
func (c *UpdateFailHTLC) TargetChanID() ChannelID {
×
94
        return c.ChanID
×
95
}
×
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