• 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_fulfill_htlc.go
1
package lnwire
2

3
import (
4
        "io"
5
)
6

7
// UpdateFulfillHTLC is sent by Alice to Bob when she wishes to settle a
8
// particular HTLC referenced by its HTLCKey within a specific active channel
9
// referenced by ChannelPoint.  A subsequent CommitSig message will be sent by
10
// Alice to "lock-in" the removal of the specified HTLC, possible containing a
11
// batch signature covering several settled HTLC's.
12
type UpdateFulfillHTLC struct {
13
        // ChanID references an active channel which holds the HTLC to be
14
        // settled.
15
        ChanID ChannelID
16

17
        // ID denotes the exact HTLC stage within the receiving node's
18
        // commitment transaction to be removed.
19
        ID uint64
20

21
        // PaymentPreimage is the R-value preimage required to fully settle an
22
        // HTLC.
23
        PaymentPreimage [32]byte
24
}
25

26
// NewUpdateFulfillHTLC returns a new empty UpdateFulfillHTLC.
27
func NewUpdateFulfillHTLC(chanID ChannelID, id uint64,
28
        preimage [32]byte) *UpdateFulfillHTLC {
×
29

×
30
        return &UpdateFulfillHTLC{
×
31
                ChanID:          chanID,
×
32
                ID:              id,
×
33
                PaymentPreimage: preimage,
×
34
        }
×
35
}
×
36

37
// A compile time check to ensure UpdateFulfillHTLC implements the lnwire.Message
38
// interface.
39
var _ Message = (*UpdateFulfillHTLC)(nil)
40

41
// Decode deserializes a serialized UpdateFulfillHTLC message stored in the passed
42
// io.Reader observing the specified protocol version.
43
//
44
// This is part of the lnwire.Message interface.
UNCOV
45
func (c *UpdateFulfillHTLC) Decode(r io.Reader, pver uint32) error {
×
UNCOV
46
        return ReadElements(r,
×
UNCOV
47
                &c.ChanID,
×
UNCOV
48
                &c.ID,
×
UNCOV
49
                c.PaymentPreimage[:],
×
UNCOV
50
        )
×
UNCOV
51
}
×
52

53
// Encode serializes the target UpdateFulfillHTLC into the passed io.Writer
54
// observing the protocol version specified.
55
//
56
// This is part of the lnwire.Message interface.
UNCOV
57
func (c *UpdateFulfillHTLC) Encode(w io.Writer, pver uint32) error {
×
UNCOV
58
        return WriteElements(w,
×
UNCOV
59
                c.ChanID,
×
UNCOV
60
                c.ID,
×
UNCOV
61
                c.PaymentPreimage[:],
×
UNCOV
62
        )
×
UNCOV
63
}
×
64

65
// MsgType returns the integer uniquely identifying this message type on the
66
// wire.
67
//
68
// This is part of the lnwire.Message interface.
UNCOV
69
func (c *UpdateFulfillHTLC) MsgType() MessageType {
×
UNCOV
70
        return MsgUpdateFulfillHTLC
×
UNCOV
71
}
×
72

73
// MaxPayloadLength returns the maximum allowed payload size for an UpdateFulfillHTLC
74
// complete message observing the specified protocol version.
75
//
76
// This is part of the lnwire.Message interface.
UNCOV
77
func (c *UpdateFulfillHTLC) MaxPayloadLength(uint32) uint32 {
×
UNCOV
78
        // 32 + 8 + 32
×
UNCOV
79
        return 72
×
UNCOV
80
}
×
81

82
// TargetChanID returns the channel id of the link for which this message is
83
// intended.
84
//
85
// NOTE: Part of peer.LinkUpdater interface.
86
func (c *UpdateFulfillHTLC) TargetChanID() ChannelID {
×
87
        return c.ChanID
×
88
}
×
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