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

lightningnetwork / lnd / 11170835610

03 Oct 2024 10:41PM UTC coverage: 49.188% (-9.6%) from 58.738%
11170835610

push

github

web-flow
Merge pull request #9154 from ziggie1984/master

multi: bump btcd version.

3 of 6 new or added lines in 6 files covered. (50.0%)

26110 existing lines in 428 files now uncovered.

97359 of 197934 relevant lines covered (49.19%)

1.04 hits per line

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

0.0
/channeldb/migration32/route.go
1
package migration32
2

3
import (
4
        "bytes"
5
        "encoding/binary"
6
        "fmt"
7
        "io"
8

9
        "github.com/btcsuite/btcd/btcec/v2"
10
        "github.com/btcsuite/btcd/wire"
11
        lnwire "github.com/lightningnetwork/lnd/channeldb/migration/lnwire21"
12
        "github.com/lightningnetwork/lnd/tlv"
13
)
14

15
const (
16
        // MPPOnionType is the type used in the onion to reference the MPP
17
        // fields: total_amt and payment_addr.
18
        MPPOnionType tlv.Type = 8
19

20
        // AMPOnionType is the type used in the onion to reference the AMP
21
        // fields: root_share, set_id, and child_index.
22
        AMPOnionType tlv.Type = 14
23
)
24

25
// VertexSize is the size of the array to store a vertex.
26
const VertexSize = 33
27

28
// Vertex is a simple alias for the serialization of a compressed Bitcoin
29
// public key.
30
type Vertex [VertexSize]byte
31

32
// Route represents a path through the channel graph which runs over one or
33
// more channels in succession. This struct carries all the information
34
// required to craft the Sphinx onion packet, and send the payment along the
35
// first hop in the path. A route is only selected as valid if all the channels
36
// have sufficient capacity to carry the initial payment amount after fees are
37
// accounted for.
38
type Route struct {
39
        // TotalTimeLock is the cumulative (final) time lock across the entire
40
        // route. This is the CLTV value that should be extended to the first
41
        // hop in the route. All other hops will decrement the time-lock as
42
        // advertised, leaving enough time for all hops to wait for or present
43
        // the payment preimage to complete the payment.
44
        TotalTimeLock uint32
45

46
        // TotalAmount is the total amount of funds required to complete a
47
        // payment over this route. This value includes the cumulative fees at
48
        // each hop. As a result, the HTLC extended to the first-hop in the
49
        // route will need to have at least this many satoshis, otherwise the
50
        // route will fail at an intermediate node due to an insufficient
51
        // amount of fees.
52
        TotalAmount lnwire.MilliSatoshi
53

54
        // SourcePubKey is the pubkey of the node where this route originates
55
        // from.
56
        SourcePubKey Vertex
57

58
        // Hops contains details concerning the specific forwarding details at
59
        // each hop.
60
        Hops []*Hop
61

62
        // FirstHopAmount is the amount that should actually be sent to the
63
        // first hop in the route. This is only different from TotalAmount above
64
        // for custom channels where the on-chain amount doesn't necessarily
65
        // reflect all the value of an outgoing payment.
66
        FirstHopAmount tlv.RecordT[
67
                tlv.TlvType0, tlv.BigSizeT[lnwire.MilliSatoshi],
68
        ]
69

70
        // FirstHopWireCustomRecords is a set of custom records that should be
71
        // included in the wire message sent to the first hop. This is only set
72
        // on custom channels and is used to include additional information
73
        // about the actual value of the payment.
74
        //
75
        // NOTE: Since these records already represent TLV records, and we
76
        // enforce them to be in the custom range (e.g. >= 65536), we don't use
77
        // another parent record type here. Instead, when serializing the Route
78
        // we merge the TLV records together with the custom records and encode
79
        // everything as a single TLV stream.
80
        FirstHopWireCustomRecords lnwire.CustomRecords
81
}
82

83
// Hop represents an intermediate or final node of the route. This naming
84
// is in line with the definition given in BOLT #4: Onion Routing Protocol.
85
// The struct houses the channel along which this hop can be reached and
86
// the values necessary to create the HTLC that needs to be sent to the
87
// next hop. It is also used to encode the per-hop payload included within
88
// the Sphinx packet.
89
type Hop struct {
90
        // PubKeyBytes is the raw bytes of the public key of the target node.
91
        PubKeyBytes Vertex
92

93
        // ChannelID is the unique channel ID for the channel. The first 3
94
        // bytes are the block height, the next 3 the index within the block,
95
        // and the last 2 bytes are the output index for the channel.
96
        ChannelID uint64
97

98
        // OutgoingTimeLock is the timelock value that should be used when
99
        // crafting the _outgoing_ HTLC from this hop.
100
        OutgoingTimeLock uint32
101

102
        // AmtToForward is the amount that this hop will forward to the next
103
        // hop. This value is less than the value that the incoming HTLC
104
        // carries as a fee will be subtracted by the hop.
105
        AmtToForward lnwire.MilliSatoshi
106

107
        // MPP encapsulates the data required for option_mpp. This field should
108
        // only be set for the final hop.
109
        MPP *MPP
110

111
        // AMP encapsulates the data required for option_amp. This field should
112
        // only be set for the final hop.
113
        AMP *AMP
114

115
        // CustomRecords if non-nil are a set of additional TLV records that
116
        // should be included in the forwarding instructions for this node.
117
        CustomRecords lnwire.CustomRecords
118

119
        // LegacyPayload if true, then this signals that this node doesn't
120
        // understand the new TLV payload, so we must instead use the legacy
121
        // payload.
122
        //
123
        // NOTE: we should no longer ever create a Hop with Legacy set to true.
124
        // The only reason we are keeping this member is that it could be the
125
        // case that we have serialised hops persisted to disk where
126
        // LegacyPayload is true.
127
        LegacyPayload bool
128

129
        // Metadata is additional data that is sent along with the payment to
130
        // the payee.
131
        Metadata []byte
132

133
        // EncryptedData is an encrypted data blob includes for hops that are
134
        // part of a blinded route.
135
        EncryptedData []byte
136

137
        // BlindingPoint is an ephemeral public key used by introduction nodes
138
        // in blinded routes to unblind their portion of the route and pass on
139
        // the next ephemeral key to the next blinded node to do the same.
140
        BlindingPoint *btcec.PublicKey
141

142
        // TotalAmtMsat is the total amount for a blinded payment, potentially
143
        // spread over more than one HTLC. This field should only be set for
144
        // the final hop in a blinded path.
145
        TotalAmtMsat lnwire.MilliSatoshi
146
}
147

148
// MPP is a record that encodes the fields necessary for multi-path payments.
149
type MPP struct {
150
        // paymentAddr is a random, receiver-generated value used to avoid
151
        // collisions with concurrent payers.
152
        paymentAddr [32]byte
153

154
        // totalMsat is the total value of the payment, potentially spread
155
        // across more than one HTLC.
156
        totalMsat lnwire.MilliSatoshi
157
}
158

159
// Record returns a tlv.Record that can be used to encode or decode this record.
UNCOV
160
func (r *MPP) Record() tlv.Record {
×
UNCOV
161
        // Fixed-size, 32 byte payment address followed by truncated 64-bit
×
UNCOV
162
        // total msat.
×
UNCOV
163
        size := func() uint64 {
×
164
                return 32 + tlv.SizeTUint64(uint64(r.totalMsat))
×
165
        }
×
166

UNCOV
167
        return tlv.MakeDynamicRecord(
×
UNCOV
168
                MPPOnionType, r, size, MPPEncoder, MPPDecoder,
×
UNCOV
169
        )
×
170
}
171

172
const (
173
        // minMPPLength is the minimum length of a serialized MPP TLV record,
174
        // which occurs when the truncated encoding of total_amt_msat takes 0
175
        // bytes, leaving only the payment_addr.
176
        minMPPLength = 32
177

178
        // maxMPPLength is the maximum length of a serialized MPP TLV record,
179
        // which occurs when the truncated encoding of total_amt_msat takes 8
180
        // bytes.
181
        maxMPPLength = 40
182
)
183

184
// MPPEncoder writes the MPP record to the provided io.Writer.
UNCOV
185
func MPPEncoder(w io.Writer, val interface{}, buf *[8]byte) error {
×
UNCOV
186
        if v, ok := val.(*MPP); ok {
×
UNCOV
187
                err := tlv.EBytes32(w, &v.paymentAddr, buf)
×
UNCOV
188
                if err != nil {
×
189
                        return err
×
190
                }
×
191

UNCOV
192
                return tlv.ETUint64T(w, uint64(v.totalMsat), buf)
×
193
        }
194

195
        return tlv.NewTypeForEncodingErr(val, "MPP")
×
196
}
197

198
// MPPDecoder reads the MPP record to the provided io.Reader.
UNCOV
199
func MPPDecoder(r io.Reader, val interface{}, buf *[8]byte, l uint64) error {
×
UNCOV
200
        if v, ok := val.(*MPP); ok && minMPPLength <= l && l <= maxMPPLength {
×
UNCOV
201
                if err := tlv.DBytes32(r, &v.paymentAddr, buf, 32); err != nil {
×
202
                        return err
×
203
                }
×
204

UNCOV
205
                var total uint64
×
UNCOV
206
                if err := tlv.DTUint64(r, &total, buf, l-32); err != nil {
×
207
                        return err
×
208
                }
×
UNCOV
209
                v.totalMsat = lnwire.MilliSatoshi(total)
×
UNCOV
210

×
UNCOV
211
                return nil
×
212
        }
213

214
        return tlv.NewTypeForDecodingErr(val, "MPP", l, maxMPPLength)
×
215
}
216

217
// AMP is a record that encodes the fields necessary for atomic multi-path
218
// payments.
219
type AMP struct {
220
        rootShare  [32]byte
221
        setID      [32]byte
222
        childIndex uint32
223
}
224

225
// AMPEncoder writes the AMP record to the provided io.Writer.
UNCOV
226
func AMPEncoder(w io.Writer, val interface{}, buf *[8]byte) error {
×
UNCOV
227
        if v, ok := val.(*AMP); ok {
×
UNCOV
228
                if err := tlv.EBytes32(w, &v.rootShare, buf); err != nil {
×
229
                        return err
×
230
                }
×
231

UNCOV
232
                if err := tlv.EBytes32(w, &v.setID, buf); err != nil {
×
233
                        return err
×
234
                }
×
235

UNCOV
236
                return tlv.ETUint32T(w, v.childIndex, buf)
×
237
        }
238

239
        return tlv.NewTypeForEncodingErr(val, "AMP")
×
240
}
241

242
const (
243
        // minAMPLength is the minimum length of a serialized AMP TLV record,
244
        // which occurs when the truncated encoding of child_index takes 0
245
        // bytes, leaving only the root_share and set_id.
246
        minAMPLength = 64
247

248
        // maxAMPLength is the maximum length of a serialized AMP TLV record,
249
        // which occurs when the truncated encoding of a child_index takes 2
250
        // bytes.
251
        maxAMPLength = 68
252
)
253

254
// AMPDecoder reads the AMP record from the provided io.Reader.
UNCOV
255
func AMPDecoder(r io.Reader, val interface{}, buf *[8]byte, l uint64) error {
×
UNCOV
256
        if v, ok := val.(*AMP); ok && minAMPLength <= l && l <= maxAMPLength {
×
UNCOV
257
                if err := tlv.DBytes32(r, &v.rootShare, buf, 32); err != nil {
×
258
                        return err
×
259
                }
×
260

UNCOV
261
                if err := tlv.DBytes32(r, &v.setID, buf, 32); err != nil {
×
262
                        return err
×
263
                }
×
264

UNCOV
265
                return tlv.DTUint32(r, &v.childIndex, buf, l-minAMPLength)
×
266
        }
267

268
        return tlv.NewTypeForDecodingErr(val, "AMP", l, maxAMPLength)
×
269
}
270

271
// Record returns a tlv.Record that can be used to encode or decode this record.
UNCOV
272
func (a *AMP) Record() tlv.Record {
×
UNCOV
273
        return tlv.MakeDynamicRecord(
×
UNCOV
274
                AMPOnionType, a, a.PayloadSize, AMPEncoder, AMPDecoder,
×
UNCOV
275
        )
×
UNCOV
276
}
×
277

278
// PayloadSize returns the size this record takes up in encoded form.
279
func (a *AMP) PayloadSize() uint64 {
×
280
        return 32 + 32 + tlv.SizeTUint32(a.childIndex)
×
281
}
×
282

283
// SerializeRoute serializes a route.
UNCOV
284
func SerializeRoute(w io.Writer, r Route) error {
×
UNCOV
285
        if err := WriteElements(w,
×
UNCOV
286
                r.TotalTimeLock, r.TotalAmount, r.SourcePubKey[:],
×
UNCOV
287
        ); err != nil {
×
288
                return err
×
289
        }
×
290

UNCOV
291
        if err := WriteElements(w, uint32(len(r.Hops))); err != nil {
×
292
                return err
×
293
        }
×
294

UNCOV
295
        for _, h := range r.Hops {
×
UNCOV
296
                if err := serializeHop(w, h); err != nil {
×
297
                        return err
×
298
                }
×
299
        }
300

301
        // Any new/extra TLV data is encoded in serializeHTLCAttemptInfo!
302

UNCOV
303
        return nil
×
304
}
305

UNCOV
306
func serializeHop(w io.Writer, h *Hop) error {
×
UNCOV
307
        if err := WriteElements(w,
×
UNCOV
308
                h.PubKeyBytes[:],
×
UNCOV
309
                h.ChannelID,
×
UNCOV
310
                h.OutgoingTimeLock,
×
UNCOV
311
                h.AmtToForward,
×
UNCOV
312
        ); err != nil {
×
313
                return err
×
314
        }
×
315

UNCOV
316
        if err := binary.Write(w, byteOrder, h.LegacyPayload); err != nil {
×
317
                return err
×
318
        }
×
319

320
        // For legacy payloads, we don't need to write any TLV records, so
321
        // we'll write a zero indicating the our serialized TLV map has no
322
        // records.
UNCOV
323
        if h.LegacyPayload {
×
UNCOV
324
                return WriteElements(w, uint32(0))
×
UNCOV
325
        }
×
326

327
        // Gather all non-primitive TLV records so that they can be serialized
328
        // as a single blob.
329
        //
330
        // TODO(conner): add migration to unify all fields in a single TLV
331
        // blobs. The split approach will cause headaches down the road as more
332
        // fields are added, which we can avoid by having a single TLV stream
333
        // for all payload fields.
UNCOV
334
        var records []tlv.Record
×
UNCOV
335
        if h.MPP != nil {
×
UNCOV
336
                records = append(records, h.MPP.Record())
×
UNCOV
337
        }
×
338

339
        // Add blinding point and encrypted data if present.
UNCOV
340
        if h.EncryptedData != nil {
×
UNCOV
341
                records = append(records, NewEncryptedDataRecord(
×
UNCOV
342
                        &h.EncryptedData,
×
UNCOV
343
                ))
×
UNCOV
344
        }
×
345

UNCOV
346
        if h.BlindingPoint != nil {
×
UNCOV
347
                records = append(records, NewBlindingPointRecord(
×
UNCOV
348
                        &h.BlindingPoint,
×
UNCOV
349
                ))
×
UNCOV
350
        }
×
351

UNCOV
352
        if h.AMP != nil {
×
UNCOV
353
                records = append(records, h.AMP.Record())
×
UNCOV
354
        }
×
355

UNCOV
356
        if h.Metadata != nil {
×
UNCOV
357
                records = append(records, NewMetadataRecord(&h.Metadata))
×
UNCOV
358
        }
×
359

UNCOV
360
        if h.TotalAmtMsat != 0 {
×
UNCOV
361
                totalMsatInt := uint64(h.TotalAmtMsat)
×
UNCOV
362
                records = append(
×
UNCOV
363
                        records, NewTotalAmtMsatBlinded(&totalMsatInt),
×
UNCOV
364
                )
×
UNCOV
365
        }
×
366

367
        // Final sanity check to absolutely rule out custom records that are not
368
        // custom and write into the standard range.
UNCOV
369
        if err := h.CustomRecords.Validate(); err != nil {
×
370
                return err
×
371
        }
×
372

373
        // Convert custom records to tlv and add to the record list.
374
        // MapToRecords sorts the list, so adding it here will keep the list
375
        // canonical.
UNCOV
376
        tlvRecords := tlv.MapToRecords(h.CustomRecords)
×
UNCOV
377
        records = append(records, tlvRecords...)
×
UNCOV
378

×
UNCOV
379
        // Otherwise, we'll transform our slice of records into a map of the
×
UNCOV
380
        // raw bytes, then serialize them in-line with a length (number of
×
UNCOV
381
        // elements) prefix.
×
UNCOV
382
        mapRecords, err := tlv.RecordsToMap(records)
×
UNCOV
383
        if err != nil {
×
384
                return err
×
385
        }
×
386

UNCOV
387
        numRecords := uint32(len(mapRecords))
×
UNCOV
388
        if err := WriteElements(w, numRecords); err != nil {
×
389
                return err
×
390
        }
×
391

UNCOV
392
        for recordType, rawBytes := range mapRecords {
×
UNCOV
393
                if err := WriteElements(w, recordType); err != nil {
×
394
                        return err
×
395
                }
×
396

UNCOV
397
                if err := wire.WriteVarBytes(w, 0, rawBytes); err != nil {
×
398
                        return err
×
399
                }
×
400
        }
401

UNCOV
402
        return nil
×
403
}
404

405
// DeserializeRoute deserializes a route.
UNCOV
406
func DeserializeRoute(r io.Reader) (Route, error) {
×
UNCOV
407
        rt := Route{}
×
UNCOV
408
        if err := ReadElements(r,
×
UNCOV
409
                &rt.TotalTimeLock, &rt.TotalAmount,
×
UNCOV
410
        ); err != nil {
×
411
                return rt, err
×
412
        }
×
413

UNCOV
414
        var pub []byte
×
UNCOV
415
        if err := ReadElements(r, &pub); err != nil {
×
416
                return rt, err
×
417
        }
×
UNCOV
418
        copy(rt.SourcePubKey[:], pub)
×
UNCOV
419

×
UNCOV
420
        var numHops uint32
×
UNCOV
421
        if err := ReadElements(r, &numHops); err != nil {
×
422
                return rt, err
×
423
        }
×
424

UNCOV
425
        var hops []*Hop
×
UNCOV
426
        for i := uint32(0); i < numHops; i++ {
×
UNCOV
427
                hop, err := deserializeHop(r)
×
UNCOV
428
                if err != nil {
×
429
                        return rt, err
×
430
                }
×
UNCOV
431
                hops = append(hops, hop)
×
432
        }
UNCOV
433
        rt.Hops = hops
×
UNCOV
434

×
UNCOV
435
        // Any new/extra TLV data is decoded in deserializeHTLCAttemptInfo!
×
UNCOV
436

×
UNCOV
437
        return rt, nil
×
438
}
439

440
// maxOnionPayloadSize is the largest Sphinx payload possible, so we don't need
441
// to read/write a TLV stream larger than this.
442
const maxOnionPayloadSize = 1300
443

UNCOV
444
func deserializeHop(r io.Reader) (*Hop, error) {
×
UNCOV
445
        h := &Hop{}
×
UNCOV
446

×
UNCOV
447
        var pub []byte
×
UNCOV
448
        if err := ReadElements(r, &pub); err != nil {
×
449
                return nil, err
×
450
        }
×
UNCOV
451
        copy(h.PubKeyBytes[:], pub)
×
UNCOV
452

×
UNCOV
453
        if err := ReadElements(r,
×
UNCOV
454
                &h.ChannelID, &h.OutgoingTimeLock, &h.AmtToForward,
×
UNCOV
455
        ); err != nil {
×
456
                return nil, err
×
457
        }
×
458

459
        // TODO(roasbeef): change field to allow LegacyPayload false to be the
460
        // legacy default?
UNCOV
461
        err := binary.Read(r, byteOrder, &h.LegacyPayload)
×
UNCOV
462
        if err != nil {
×
463
                return nil, err
×
464
        }
×
465

UNCOV
466
        var numElements uint32
×
UNCOV
467
        if err := ReadElements(r, &numElements); err != nil {
×
468
                return nil, err
×
469
        }
×
470

471
        // If there're no elements, then we can return early.
UNCOV
472
        if numElements == 0 {
×
UNCOV
473
                return h, nil
×
UNCOV
474
        }
×
475

UNCOV
476
        tlvMap := make(map[uint64][]byte)
×
UNCOV
477
        for i := uint32(0); i < numElements; i++ {
×
UNCOV
478
                var tlvType uint64
×
UNCOV
479
                if err := ReadElements(r, &tlvType); err != nil {
×
480
                        return nil, err
×
481
                }
×
482

UNCOV
483
                rawRecordBytes, err := wire.ReadVarBytes(
×
UNCOV
484
                        r, 0, maxOnionPayloadSize, "tlv",
×
UNCOV
485
                )
×
UNCOV
486
                if err != nil {
×
487
                        return nil, err
×
488
                }
×
489

UNCOV
490
                tlvMap[tlvType] = rawRecordBytes
×
491
        }
492

493
        // If the MPP type is present, remove it from the generic TLV map and
494
        // parse it back into a proper MPP struct.
495
        //
496
        // TODO(conner): add migration to unify all fields in a single TLV
497
        // blobs. The split approach will cause headaches down the road as more
498
        // fields are added, which we can avoid by having a single TLV stream
499
        // for all payload fields.
UNCOV
500
        mppType := uint64(MPPOnionType)
×
UNCOV
501
        if mppBytes, ok := tlvMap[mppType]; ok {
×
UNCOV
502
                delete(tlvMap, mppType)
×
UNCOV
503

×
UNCOV
504
                var (
×
UNCOV
505
                        mpp    = &MPP{}
×
UNCOV
506
                        mppRec = mpp.Record()
×
UNCOV
507
                        r      = bytes.NewReader(mppBytes)
×
UNCOV
508
                )
×
UNCOV
509
                err := mppRec.Decode(r, uint64(len(mppBytes)))
×
UNCOV
510
                if err != nil {
×
511
                        return nil, err
×
512
                }
×
UNCOV
513
                h.MPP = mpp
×
514
        }
515

516
        // If encrypted data or blinding key are present, remove them from
517
        // the TLV map and parse into proper types.
UNCOV
518
        encryptedDataType := uint64(EncryptedDataOnionType)
×
UNCOV
519
        if data, ok := tlvMap[encryptedDataType]; ok {
×
UNCOV
520
                delete(tlvMap, encryptedDataType)
×
UNCOV
521
                h.EncryptedData = data
×
UNCOV
522
        }
×
523

UNCOV
524
        blindingType := uint64(BlindingPointOnionType)
×
UNCOV
525
        if blindingPoint, ok := tlvMap[blindingType]; ok {
×
UNCOV
526
                delete(tlvMap, blindingType)
×
UNCOV
527

×
UNCOV
528
                h.BlindingPoint, err = btcec.ParsePubKey(blindingPoint)
×
UNCOV
529
                if err != nil {
×
530
                        return nil, fmt.Errorf("invalid blinding point: %w",
×
531
                                err)
×
532
                }
×
533
        }
534

UNCOV
535
        ampType := uint64(AMPOnionType)
×
UNCOV
536
        if ampBytes, ok := tlvMap[ampType]; ok {
×
UNCOV
537
                delete(tlvMap, ampType)
×
UNCOV
538

×
UNCOV
539
                var (
×
UNCOV
540
                        amp    = &AMP{}
×
UNCOV
541
                        ampRec = amp.Record()
×
UNCOV
542
                        r      = bytes.NewReader(ampBytes)
×
UNCOV
543
                )
×
UNCOV
544
                err := ampRec.Decode(r, uint64(len(ampBytes)))
×
UNCOV
545
                if err != nil {
×
546
                        return nil, err
×
547
                }
×
UNCOV
548
                h.AMP = amp
×
549
        }
550

551
        // If the metadata type is present, remove it from the tlv map and
552
        // populate directly on the hop.
UNCOV
553
        metadataType := uint64(MetadataOnionType)
×
UNCOV
554
        if metadata, ok := tlvMap[metadataType]; ok {
×
UNCOV
555
                delete(tlvMap, metadataType)
×
UNCOV
556

×
UNCOV
557
                h.Metadata = metadata
×
UNCOV
558
        }
×
559

UNCOV
560
        totalAmtMsatType := uint64(TotalAmtMsatBlindedType)
×
UNCOV
561
        if totalAmtMsat, ok := tlvMap[totalAmtMsatType]; ok {
×
UNCOV
562
                delete(tlvMap, totalAmtMsatType)
×
UNCOV
563

×
UNCOV
564
                var (
×
UNCOV
565
                        totalAmtMsatInt uint64
×
UNCOV
566
                        buf             [8]byte
×
UNCOV
567
                )
×
UNCOV
568
                if err := tlv.DTUint64(
×
UNCOV
569
                        bytes.NewReader(totalAmtMsat),
×
UNCOV
570
                        &totalAmtMsatInt,
×
UNCOV
571
                        &buf,
×
UNCOV
572
                        uint64(len(totalAmtMsat)),
×
UNCOV
573
                ); err != nil {
×
574
                        return nil, err
×
575
                }
×
576

UNCOV
577
                h.TotalAmtMsat = lnwire.MilliSatoshi(totalAmtMsatInt)
×
578
        }
579

UNCOV
580
        h.CustomRecords = tlvMap
×
UNCOV
581

×
UNCOV
582
        return h, nil
×
583
}
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