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

lightningnetwork / lnd / 13536249039

26 Feb 2025 03:42AM UTC coverage: 57.462% (-1.4%) from 58.835%
13536249039

Pull #8453

github

Roasbeef
peer: update chooseDeliveryScript to gen script if needed

In this commit, we update `chooseDeliveryScript` to generate a new
script if needed. This allows us to fold in a few other lines that
always followed this function into this expanded function.

The tests have been updated accordingly.
Pull Request #8453: [4/4] - multi: integrate new rbf coop close FSM into the existing peer flow

275 of 1318 new or added lines in 22 files covered. (20.86%)

19521 existing lines in 257 files now uncovered.

103858 of 180741 relevant lines covered (57.46%)

24750.23 hits per line

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

64.0
/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
// Decode deserializes a serialized UpdateFailHTLC message stored in the passed
42
// io.Reader observing the specified protocol version.
43
//
44
// This is part of the lnwire.Message interface.
45
func (c *UpdateFailHTLC) Decode(r io.Reader, pver uint32) error {
570✔
46
        return ReadElements(r,
570✔
47
                &c.ChanID,
570✔
48
                &c.ID,
570✔
49
                &c.Reason,
570✔
50
                &c.ExtraData,
570✔
51
        )
570✔
52
}
570✔
53

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

63
        if err := WriteUint64(w, c.ID); err != nil {
792✔
64
                return err
×
65
        }
×
66

67
        if err := WriteOpaqueReason(w, c.Reason); err != nil {
792✔
68
                return err
×
69
        }
×
70

71
        return WriteBytes(w, c.ExtraData)
792✔
72
}
73

74
// MsgType returns the integer uniquely identifying this message type on the
75
// wire.
76
//
77
// This is part of the lnwire.Message interface.
78
func (c *UpdateFailHTLC) MsgType() MessageType {
930✔
79
        return MsgUpdateFailHTLC
930✔
80
}
930✔
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.
UNCOV
86
func (c *UpdateFailHTLC) TargetChanID() ChannelID {
×
UNCOV
87
        return c.ChanID
×
UNCOV
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