• 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

66.67
/lnwire/update_fail_malformed_htlc.go
1
package lnwire
2

3
import (
4
        "bytes"
5
        "crypto/sha256"
6
        "io"
7
)
8

9
// UpdateFailMalformedHTLC is sent by either the payment forwarder or by
10
// payment receiver to the payment sender in order to notify it that the onion
11
// blob can't be parsed. For that reason we send this message instead of
12
// obfuscate the onion failure.
13
type UpdateFailMalformedHTLC struct {
14
        // ChanID is the particular active channel that this
15
        // UpdateFailMalformedHTLC is bound to.
16
        ChanID ChannelID
17

18
        // ID references which HTLC on the remote node's commitment transaction
19
        // has timed out.
20
        ID uint64
21

22
        // ShaOnionBlob hash of the onion blob on which can't be parsed by the
23
        // node in the payment path.
24
        ShaOnionBlob [sha256.Size]byte
25

26
        // FailureCode the exact reason why onion blob haven't been parsed.
27
        FailureCode FailCode
28

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

35
// A compile time check to ensure UpdateFailMalformedHTLC implements the
36
// lnwire.Message interface.
37
var _ Message = (*UpdateFailMalformedHTLC)(nil)
38

39
// A compile time check to ensure UpdateFailMalformedHTLC implements the
40
// lnwire.SizeableMessage interface.
41
var _ SizeableMessage = (*UpdateFailMalformedHTLC)(nil)
42

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

57
// Encode serializes the target UpdateFailMalformedHTLC into the passed
58
// io.Writer observing the protocol version specified.
59
//
60
// This is part of the lnwire.Message interface.
61
func (c *UpdateFailMalformedHTLC) Encode(w *bytes.Buffer,
62
        pver uint32) error {
3✔
63

3✔
64
        if err := WriteChannelID(w, c.ChanID); err != nil {
3✔
65
                return err
×
66
        }
×
67

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

72
        if err := WriteBytes(w, c.ShaOnionBlob[:]); err != nil {
3✔
73
                return err
×
74
        }
×
75

76
        if err := WriteFailCode(w, c.FailureCode); err != nil {
3✔
77
                return err
×
78
        }
×
79

80
        return WriteBytes(w, c.ExtraData)
3✔
81
}
82

83
// MsgType returns the integer uniquely identifying this message type on the
84
// wire.
85
//
86
// This is part of the lnwire.Message interface.
87
func (c *UpdateFailMalformedHTLC) MsgType() MessageType {
3✔
88
        return MsgUpdateFailMalformedHTLC
3✔
89
}
3✔
90

91
// SerializedSize returns the serialized size of the message in bytes.
92
//
93
// This is part of the lnwire.SizeableMessage interface.
NEW
94
func (c *UpdateFailMalformedHTLC) SerializedSize() (uint32, error) {
×
NEW
95
        return MessageSerializedSize(c)
×
NEW
96
}
×
97

98
// TargetChanID returns the channel id of the link for which this message is
99
// intended.
100
//
101
// NOTE: Part of peer.LinkUpdater interface.
102
func (c *UpdateFailMalformedHTLC) TargetChanID() ChannelID {
3✔
103
        return c.ChanID
3✔
104
}
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