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

lightningnetwork / lnd / 15561477203

10 Jun 2025 01:54PM UTC coverage: 58.351% (-10.1%) from 68.487%
15561477203

Pull #9356

github

web-flow
Merge 6440b25db into c6d6d4c0b
Pull Request #9356: lnrpc: add incoming/outgoing channel ids filter to forwarding history request

33 of 36 new or added lines in 2 files covered. (91.67%)

28366 existing lines in 455 files now uncovered.

97715 of 167461 relevant lines covered (58.35%)

1.81 hits per line

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

85.19
/lnwire/channel_type.go
1
package lnwire
2

3
import (
4
        "io"
5

6
        "github.com/lightningnetwork/lnd/tlv"
7
)
8

9
const (
10
        // ChannelTypeRecordType is the type of the experimental record used
11
        // to denote which channel type is being negotiated.
12
        ChannelTypeRecordType tlv.Type = 1
13
)
14

15
// ChannelType represents a specific channel type as a set of feature bits that
16
// comprise it.
17
type ChannelType RawFeatureVector
18

19
// featureBitLen returns the length in bytes of the encoded feature bits.
20
func (c ChannelType) featureBitLen() uint64 {
3✔
21
        fv := RawFeatureVector(c)
3✔
22
        return fv.sizeFunc()
3✔
23
}
3✔
24

25
// Record returns a TLV record that can be used to encode/decode the channel
26
// type from a given TLV stream.
27
func (c *ChannelType) Record() tlv.Record {
3✔
28
        return tlv.MakeDynamicRecord(
3✔
29
                ChannelTypeRecordType, c, c.featureBitLen, channelTypeEncoder,
3✔
30
                channelTypeDecoder,
3✔
31
        )
3✔
32
}
3✔
33

34
// channelTypeEncoder is a custom TLV encoder for the ChannelType record.
35
func channelTypeEncoder(w io.Writer, val interface{}, buf *[8]byte) error {
3✔
36
        if v, ok := val.(*ChannelType); ok {
6✔
37
                fv := RawFeatureVector(*v)
3✔
38
                return rawFeatureEncoder(w, &fv, buf)
3✔
39
        }
3✔
40

41
        return tlv.NewTypeForEncodingErr(val, "*lnwire.ChannelType")
×
42
}
43

44
// channelTypeDecoder is a custom TLV decoder for the ChannelType record.
45
func channelTypeDecoder(r io.Reader, val interface{}, buf *[8]byte,
46
        l uint64) error {
3✔
47

3✔
48
        if v, ok := val.(*ChannelType); ok {
6✔
49
                fv := NewRawFeatureVector()
3✔
50

3✔
51
                if err := rawFeatureDecoder(r, fv, buf, l); err != nil {
3✔
UNCOV
52
                        return err
×
UNCOV
53
                }
×
54

55
                *v = ChannelType(*fv)
3✔
56
                return nil
3✔
57
        }
58

59
        return tlv.NewTypeForEncodingErr(val, "*lnwire.ChannelType")
×
60
}
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