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

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

8
// UpdateFee is the message the channel initiator sends to the other peer if
9
// the channel commitment fee needs to be updated.
10
type UpdateFee struct {
11
        // ChanID is the channel that this UpdateFee is meant for.
12
        ChanID ChannelID
13

14
        // FeePerKw is the fee-per-kw on commit transactions that the sender of
15
        // this message wants to use for this channel.
16
        //
17
        // TODO(halseth): make SatPerKWeight when fee estimation is moved to
18
        // own package. Currently this will cause an import cycle.
19
        FeePerKw uint32
20

21
        // ExtraData is the set of data that was appended to this message to
22
        // fill out the full maximum transport message size. These fields can
23
        // be used to specify optional data such as custom TLV fields.
24
        ExtraData ExtraOpaqueData
25
}
26

27
// NewUpdateFee creates a new UpdateFee message.
UNCOV
28
func NewUpdateFee(chanID ChannelID, feePerKw uint32) *UpdateFee {
×
UNCOV
29
        return &UpdateFee{
×
UNCOV
30
                ChanID:   chanID,
×
UNCOV
31
                FeePerKw: feePerKw,
×
UNCOV
32
        }
×
UNCOV
33
}
×
34

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

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

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

UNCOV
60
        if err := WriteUint32(w, c.FeePerKw); err != nil {
×
61
                return err
×
62
        }
×
63

UNCOV
64
        return WriteBytes(w, c.ExtraData)
×
65
}
66

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

75
// TargetChanID returns the channel id of the link for which this message is
76
// intended.
77
//
78
// NOTE: Part of peer.LinkUpdater interface.
79
func (c *UpdateFee) TargetChanID() ChannelID {
×
80
        return c.ChanID
×
81
}
×
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