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

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

8
// AnnounceSignatures2 is a direct message between two endpoints of a
9
// channel and serves as an opt-in mechanism to allow the announcement of
10
// a taproot channel to the rest of the network. It contains the necessary
11
// signatures by the sender to construct the channel_announcement_2 message.
12
type AnnounceSignatures2 struct {
13
        // ChannelID is the unique description of the funding transaction.
14
        // Channel id is better for users and debugging and short channel id is
15
        // used for quick test on existence of the particular utxo inside the
16
        // blockchain, because it contains information about block.
17
        ChannelID ChannelID
18

19
        // ShortChannelID is the unique description of the funding transaction.
20
        // It is constructed with the most significant 3 bytes as the block
21
        // height, the next 3 bytes indicating the transaction index within the
22
        // block, and the least significant two bytes indicating the output
23
        // index which pays to the channel.
24
        ShortChannelID ShortChannelID
25

26
        // PartialSignature is the combination of the partial Schnorr signature
27
        // created for the node's bitcoin key with the partial signature created
28
        // for the node's node ID key.
29
        PartialSignature PartialSig
30

31
        // ExtraOpaqueData is the set of data that was appended to this
32
        // message, some of which we may not actually know how to iterate or
33
        // parse. By holding onto this data, we ensure that we're able to
34
        // properly validate the set of signatures that cover these new fields,
35
        // and ensure we're able to make upgrades to the network in a forwards
36
        // compatible manner.
37
        ExtraOpaqueData ExtraOpaqueData
38
}
39

40
// A compile time check to ensure AnnounceSignatures2 implements the
41
// lnwire.Message interface.
42
var _ Message = (*AnnounceSignatures2)(nil)
43

44
// Decode deserializes a serialized AnnounceSignatures2 stored in the passed
45
// io.Reader observing the specified protocol version.
46
//
47
// This is part of the lnwire.Message interface.
UNCOV
48
func (a *AnnounceSignatures2) Decode(r io.Reader, _ uint32) error {
×
UNCOV
49
        return ReadElements(r,
×
UNCOV
50
                &a.ChannelID,
×
UNCOV
51
                &a.ShortChannelID,
×
UNCOV
52
                &a.PartialSignature,
×
UNCOV
53
                &a.ExtraOpaqueData,
×
UNCOV
54
        )
×
UNCOV
55
}
×
56

57
// Encode serializes the target AnnounceSignatures2 into the passed io.Writer
58
// observing the protocol version specified.
59
//
60
// This is part of the lnwire.Message interface.
UNCOV
61
func (a *AnnounceSignatures2) Encode(w *bytes.Buffer, _ uint32) error {
×
UNCOV
62
        if err := WriteChannelID(w, a.ChannelID); err != nil {
×
63
                return err
×
64
        }
×
65

UNCOV
66
        if err := WriteShortChannelID(w, a.ShortChannelID); err != nil {
×
67
                return err
×
68
        }
×
69

UNCOV
70
        if err := WriteElement(w, a.PartialSignature); err != nil {
×
71
                return err
×
72
        }
×
73

UNCOV
74
        return WriteBytes(w, a.ExtraOpaqueData)
×
75
}
76

77
// MsgType returns the integer uniquely identifying this message type on the
78
// wire.
79
//
80
// This is part of the lnwire.Message interface.
UNCOV
81
func (a *AnnounceSignatures2) MsgType() MessageType {
×
UNCOV
82
        return MsgAnnounceSignatures2
×
UNCOV
83
}
×
84

85
// SCID returns the ShortChannelID of the channel.
86
//
87
// NOTE: this is part of the AnnounceSignatures interface.
88
func (a *AnnounceSignatures2) SCID() ShortChannelID {
×
89
        return a.ShortChannelID
×
90
}
×
91

92
// ChanID returns the ChannelID identifying the channel.
93
//
94
// NOTE: this is part of the AnnounceSignatures interface.
95
func (a *AnnounceSignatures2) ChanID() ChannelID {
×
96
        return a.ChannelID
×
97
}
×
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