• 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

89.19
/lnwire/query_options.go
1
package lnwire
2

3
import (
4
        "io"
5

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

9
const (
10
        // QueryOptionsRecordType is the TLV number of the query_options TLV
11
        // record in the query_channel_range message.
12
        QueryOptionsRecordType tlv.Type = 1
13

14
        // QueryOptionTimestampBit is the bit position in the query_option
15
        // feature bit vector which is used to indicate that timestamps are
16
        // desired in the reply_channel_range response.
17
        QueryOptionTimestampBit = 0
18
)
19

20
// QueryOptions is the type used to represent the query_options feature bit
21
// vector in the query_channel_range message.
22
type QueryOptions RawFeatureVector
23

24
// NewTimestampQueryOption is a helper constructor used to construct a
25
// QueryOption with the timestamp bit set.
26
func NewTimestampQueryOption() *QueryOptions {
3✔
27
        opt := QueryOptions(*NewRawFeatureVector(
3✔
28
                QueryOptionTimestampBit,
3✔
29
        ))
3✔
30

3✔
31
        return &opt
3✔
32
}
3✔
33

34
// featureBitLen calculates and returns the size of the resulting feature bit
35
// vector.
36
func (c *QueryOptions) featureBitLen() uint64 {
3✔
37
        fv := RawFeatureVector(*c)
3✔
38

3✔
39
        return uint64(fv.SerializeSize())
3✔
40
}
3✔
41

42
// Record constructs a tlv.Record from the QueryOptions to be used in the
43
// query_channel_range message.
44
func (c *QueryOptions) Record() tlv.Record {
3✔
45
        return tlv.MakeDynamicRecord(
3✔
46
                QueryOptionsRecordType, c, c.featureBitLen, queryOptionsEncoder,
3✔
47
                queryOptionsDecoder,
3✔
48
        )
3✔
49
}
3✔
50

51
// queryOptionsEncoder encodes the QueryOptions and writes it to the provided
52
// writer.
53
func queryOptionsEncoder(w io.Writer, val interface{}, _ *[8]byte) error {
3✔
54
        if v, ok := val.(*QueryOptions); ok {
6✔
55
                // Encode the feature bits as a byte slice without its length
3✔
56
                // prepended, as that's already taken care of by the TLV record.
3✔
57
                fv := RawFeatureVector(*v)
3✔
58
                return fv.encode(w, fv.SerializeSize(), 8)
3✔
59
        }
3✔
60

61
        return tlv.NewTypeForEncodingErr(val, "lnwire.QueryOptions")
×
62
}
63

64
// queryOptionsDecoder attempts to read a QueryOptions from the given reader.
65
func queryOptionsDecoder(r io.Reader, val interface{}, _ *[8]byte,
66
        l uint64) error {
3✔
67

3✔
68
        if v, ok := val.(*QueryOptions); ok {
6✔
69
                fv := NewRawFeatureVector()
3✔
70
                if err := fv.decode(r, int(l), 8); err != nil {
3✔
UNCOV
71
                        return err
×
UNCOV
72
                }
×
73

74
                *v = QueryOptions(*fv)
3✔
75

3✔
76
                return nil
3✔
77
        }
78

79
        return tlv.NewTypeForEncodingErr(val, "lnwire.QueryOptions")
×
80
}
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