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

lightningnetwork / lnd / 13035292482

29 Jan 2025 03:59PM UTC coverage: 49.3% (-9.5%) from 58.777%
13035292482

Pull #9456

github

mohamedawnallah
docs: update release-notes-0.19.0.md

In this commit, we warn users about the removal
of RPCs `SendToRoute`, `SendToRouteSync`, `SendPayment`,
and `SendPaymentSync` in the next release 0.20.
Pull Request #9456: lnrpc+docs: deprecate warning `SendToRoute`, `SendToRouteSync`, `SendPayment`, and `SendPaymentSync` in Release 0.19

100634 of 204126 relevant lines covered (49.3%)

1.54 hits per line

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

0.0
/lnwire/dyn_ack.go
1
package lnwire
2

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

7
        "github.com/btcsuite/btcd/btcec/v2/schnorr/musig2"
8
        "github.com/lightningnetwork/lnd/fn/v2"
9
        "github.com/lightningnetwork/lnd/tlv"
10
)
11

12
const (
13
        // DALocalMusig2Pubnonce is the TLV type number that identifies the
14
        // musig2 public nonce that we need to verify the commitment transaction
15
        // signature.
16
        DALocalMusig2Pubnonce tlv.Type = 0
17
)
18

19
// DynAck is the message used to accept the parameters of a dynamic commitment
20
// negotiation. Additional optional parameters will need to be present depending
21
// on the details of the dynamic commitment upgrade.
22
type DynAck struct {
23
        // ChanID is the ChannelID of the channel that is currently undergoing
24
        // a dynamic commitment negotiation
25
        ChanID ChannelID
26

27
        // LocalNonce is an optional field that is transmitted when accepting
28
        // a dynamic commitment upgrade to Taproot Channels. This nonce will be
29
        // used to verify the first commitment transaction signature. This will
30
        // only be populated if the DynPropose we are responding to specifies
31
        // taproot channels in the ChannelType field.
32
        LocalNonce fn.Option[Musig2Nonce]
33

34
        // ExtraData is the set of data that was appended to this message to
35
        // fill out the full maximum transport message size. These fields can
36
        // be used to specify optional data such as custom TLV fields.
37
        ExtraData ExtraOpaqueData
38
}
39

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

44
// Encode serializes the target DynAck into the passed io.Writer. Serialization
45
// will observe the rules defined by the passed protocol version.
46
//
47
// This is a part of the lnwire.Message interface.
48
func (da *DynAck) Encode(w *bytes.Buffer, _ uint32) error {
×
49
        if err := WriteChannelID(w, da.ChanID); err != nil {
×
50
                return err
×
51
        }
×
52

53
        var tlvRecords []tlv.Record
×
54
        da.LocalNonce.WhenSome(func(nonce Musig2Nonce) {
×
55
                tlvRecords = append(
×
56
                        tlvRecords, tlv.MakeStaticRecord(
×
57
                                DALocalMusig2Pubnonce, &nonce,
×
58
                                musig2.PubNonceSize, nonceTypeEncoder,
×
59
                                nonceTypeDecoder,
×
60
                        ),
×
61
                )
×
62
        })
×
63
        tlv.SortRecords(tlvRecords)
×
64

×
65
        tlvStream, err := tlv.NewStream(tlvRecords...)
×
66
        if err != nil {
×
67
                return err
×
68
        }
×
69

70
        var extraBytesWriter bytes.Buffer
×
71
        if err := tlvStream.Encode(&extraBytesWriter); err != nil {
×
72
                return err
×
73
        }
×
74

75
        da.ExtraData = ExtraOpaqueData(extraBytesWriter.Bytes())
×
76

×
77
        return WriteBytes(w, da.ExtraData)
×
78
}
79

80
// Decode deserializes the serialized DynAck stored in the passed io.Reader into
81
// the target DynAck using the deserialization rules defined by the passed
82
// protocol version.
83
//
84
// This is a part of the lnwire.Message interface.
85
func (da *DynAck) Decode(r io.Reader, _ uint32) error {
×
86
        // Parse out main message.
×
87
        if err := ReadElements(r, &da.ChanID); err != nil {
×
88
                return err
×
89
        }
×
90

91
        // Parse out TLV records.
92
        var tlvRecords ExtraOpaqueData
×
93
        if err := ReadElement(r, &tlvRecords); err != nil {
×
94
                return err
×
95
        }
×
96

97
        // Prepare receiving buffers to be filled by TLV extraction.
98
        var localNonceScratch Musig2Nonce
×
99
        localNonce := tlv.MakeStaticRecord(
×
100
                DALocalMusig2Pubnonce, &localNonceScratch, musig2.PubNonceSize,
×
101
                nonceTypeEncoder, nonceTypeDecoder,
×
102
        )
×
103

×
104
        // Create set of Records to read TLV bytestream into.
×
105
        records := []tlv.Record{localNonce}
×
106
        tlv.SortRecords(records)
×
107

×
108
        // Read TLV stream into record set.
×
109
        extraBytesReader := bytes.NewReader(tlvRecords)
×
110
        tlvStream, err := tlv.NewStream(records...)
×
111
        if err != nil {
×
112
                return err
×
113
        }
×
114
        typeMap, err := tlvStream.DecodeWithParsedTypesP2P(extraBytesReader)
×
115
        if err != nil {
×
116
                return err
×
117
        }
×
118

119
        // Check the results of the TLV Stream decoding and appropriately set
120
        // message fields.
121
        if val, ok := typeMap[DALocalMusig2Pubnonce]; ok && val == nil {
×
122
                da.LocalNonce = fn.Some(localNonceScratch)
×
123
        }
×
124

125
        if len(tlvRecords) != 0 {
×
126
                da.ExtraData = tlvRecords
×
127
        }
×
128

129
        return nil
×
130
}
131

132
// MsgType returns the MessageType code which uniquely identifies this message
133
// as a DynAck on the wire.
134
//
135
// This is part of the lnwire.Message interface.
136
func (da *DynAck) MsgType() MessageType {
×
137
        return MsgDynAck
×
138
}
×
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