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

lightningnetwork / lnd / 13982721865

21 Mar 2025 01:30AM UTC coverage: 58.587% (-0.5%) from 59.126%
13982721865

Pull #9623

github

web-flow
Merge 05a6b6838 into 5d921723b
Pull Request #9623: Size msg test msg

0 of 1572 new or added lines in 43 files covered. (0.0%)

17 existing lines in 5 files now uncovered.

96767 of 165169 relevant lines covered (58.59%)

1.82 hits per line

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

67.86
/lnwire/update_fail_htlc.go
1
package lnwire
2

3
import (
4
        "bytes"
5
        "io"
6
)
7

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

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

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

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

31
        // ExtraData is the set of data that was appended to this message to
32
        // fill out the full maximum transport message size. These fields can
33
        // be used to specify optional data such as custom TLV fields.
34
        ExtraData ExtraOpaqueData
35
}
36

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

41
// A compile time check to ensure UpdateFailHTLC implements the
42
// lnwire.SizeableMessage interface.
43
var _ SizeableMessage = (*UpdateFailHTLC)(nil)
44

45
// Decode deserializes a serialized UpdateFailHTLC message stored in the passed
46
// io.Reader observing the specified protocol version.
47
//
48
// This is part of the lnwire.Message interface.
49
func (c *UpdateFailHTLC) Decode(r io.Reader, pver uint32) error {
3✔
50
        return ReadElements(r,
3✔
51
                &c.ChanID,
3✔
52
                &c.ID,
3✔
53
                &c.Reason,
3✔
54
                &c.ExtraData,
3✔
55
        )
3✔
56
}
3✔
57

58
// Encode serializes the target UpdateFailHTLC into the passed io.Writer
59
// observing the protocol version specified.
60
//
61
// This is part of the lnwire.Message interface.
62
func (c *UpdateFailHTLC) Encode(w *bytes.Buffer, pver uint32) error {
3✔
63
        if err := WriteChannelID(w, c.ChanID); err != nil {
3✔
64
                return err
×
65
        }
×
66

67
        if err := WriteUint64(w, c.ID); err != nil {
3✔
68
                return err
×
69
        }
×
70

71
        if err := WriteOpaqueReason(w, c.Reason); err != nil {
3✔
72
                return err
×
73
        }
×
74

75
        return WriteBytes(w, c.ExtraData)
3✔
76
}
77

78
// MsgType returns the integer uniquely identifying this message type on the
79
// wire.
80
//
81
// This is part of the lnwire.Message interface.
82
func (c *UpdateFailHTLC) MsgType() MessageType {
3✔
83
        return MsgUpdateFailHTLC
3✔
84
}
3✔
85

86
// SerializedSize returns the serialized size of the message in bytes.
87
//
88
// This is part of the lnwire.SizeableMessage interface.
NEW
89
func (c *UpdateFailHTLC) SerializedSize() (uint32, error) {
×
NEW
90
        return MessageSerializedSize(c)
×
NEW
91
}
×
92

93
// TargetChanID returns the channel id of the link for which this message is
94
// intended.
95
//
96
// NOTE: Part of peer.LinkUpdater interface.
97
func (c *UpdateFailHTLC) TargetChanID() ChannelID {
3✔
98
        return c.ChanID
3✔
99
}
3✔
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