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

lightningnetwork / lnd / 13211764208

08 Feb 2025 03:08AM UTC coverage: 49.288% (-9.5%) from 58.815%
13211764208

Pull #9489

github

calvinrzachman
itest: verify switchrpc server enforces send then track

We prevent the rpc server from allowing onion dispatches for
attempt IDs which have already been tracked by rpc clients.

This helps protect the client from leaking a duplicate onion
attempt. NOTE: This is not the only method for solving this
issue! The issue could be addressed via careful client side
programming which accounts for the uncertainty and async
nature of dispatching onions to a remote process via RPC.
This would require some lnd ChannelRouter changes for how
we intend to use these RPCs though.
Pull Request #9489: multi: add BuildOnion, SendOnion, and TrackOnion RPCs

474 of 990 new or added lines in 11 files covered. (47.88%)

27321 existing lines in 435 files now uncovered.

101192 of 205306 relevant lines covered (49.29%)

1.54 hits per line

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

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

3
import (
4
        "io"
5
)
6

7
// CommitSig is sent by either side to stage any pending HTLC's in the
8
// receiver's pending set into a new commitment state. Implicitly, the new
9
// commitment transaction constructed which has been signed by CommitSig
10
// includes all HTLC's in the remote node's pending set. A CommitSig message
11
// may be sent after a series of UpdateAddHTLC/UpdateFulfillHTLC messages in
12
// order to batch add several HTLC's with a single signature covering all
13
// implicitly accepted HTLC's.
14
type CommitSig struct {
15
        // ChanID uniquely identifies to which currently active channel this
16
        // CommitSig applies to.
17
        ChanID ChannelID
18

19
        // CommitSig is Alice's signature for Bob's new commitment transaction.
20
        // Alice is able to send this signature without requesting any
21
        // additional data due to the piggybacking of Bob's next revocation
22
        // hash in his prior RevokeAndAck message, as well as the canonical
23
        // ordering used for all inputs/outputs within commitment transactions.
24
        // If initiating a new commitment state, this signature should ONLY
25
        // cover all of the sending party's pending log updates, and the log
26
        // updates of the remote party that have been ACK'd.
27
        CommitSig Sig
28

29
        // HtlcSigs is a signature for each relevant HTLC output within the
30
        // created commitment. The order of the signatures is expected to be
31
        // identical to the placement of the HTLC's within the BIP 69 sorted
32
        // commitment transaction. For each outgoing HTLC (from the PoV of the
33
        // sender of this message), a signature for an HTLC timeout transaction
34
        // should be signed, for each incoming HTLC the HTLC timeout
35
        // transaction should be signed.
36
        HtlcSigs []Sig
37
}
38

39
// NewCommitSig creates a new empty CommitSig message.
40
func NewCommitSig() *CommitSig {
×
41
        return &CommitSig{}
×
42
}
×
43

44
// A compile time check to ensure CommitSig implements the lnwire.Message
45
// interface.
46
var _ Message = (*CommitSig)(nil)
47

48
// Decode deserializes a serialized CommitSig message stored in the
49
// passed io.Reader observing the specified protocol version.
50
//
51
// This is part of the lnwire.Message interface.
UNCOV
52
func (c *CommitSig) Decode(r io.Reader, pver uint32) error {
×
UNCOV
53
        return ReadElements(r,
×
UNCOV
54
                &c.ChanID,
×
UNCOV
55
                &c.CommitSig,
×
UNCOV
56
                &c.HtlcSigs,
×
UNCOV
57
        )
×
UNCOV
58
}
×
59

60
// Encode serializes the target CommitSig into the passed io.Writer
61
// observing the protocol version specified.
62
//
63
// This is part of the lnwire.Message interface.
UNCOV
64
func (c *CommitSig) Encode(w io.Writer, pver uint32) error {
×
UNCOV
65
        return WriteElements(w,
×
UNCOV
66
                c.ChanID,
×
UNCOV
67
                c.CommitSig,
×
UNCOV
68
                c.HtlcSigs,
×
UNCOV
69
        )
×
UNCOV
70
}
×
71

72
// MsgType returns the integer uniquely identifying this message type on the
73
// wire.
74
//
75
// This is part of the lnwire.Message interface.
UNCOV
76
func (c *CommitSig) MsgType() MessageType {
×
UNCOV
77
        return MsgCommitSig
×
UNCOV
78
}
×
79

80
// MaxPayloadLength returns the maximum allowed payload size for a
81
// CommitSig complete message observing the specified protocol version.
82
//
83
// This is part of the lnwire.Message interface.
UNCOV
84
func (c *CommitSig) MaxPayloadLength(uint32) uint32 {
×
UNCOV
85
        // 32 + 64 + 2 + max_allowed_htlcs
×
UNCOV
86
        return MaxMessagePayload
×
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 *CommitSig) 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