• 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

78.95
/lnwire/typed_lease_expiry.go
1
package lnwire
2

3
import (
4
        "io"
5

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

9
const (
10
        // LeaseExpiryType is the type of the experimental record used to
11
        // communicate the expiration of a channel lease throughout the channel
12
        // funding process.
13
        //
14
        // TODO: Decide on actual TLV type. Custom records start at 2^16.
15
        LeaseExpiryRecordType tlv.Type = 1 << 16
16
)
17

18
// LeaseExpiry represents the absolute expiration height of a channel lease. All
19
// outputs that pay directly to the channel initiator are locked until this
20
// height is reached.
21
type LeaseExpiry uint32
22

23
// Record returns a TLV record that can be used to encode/decode the LeaseExpiry
24
// type from a given TLV stream.
25
func (l *LeaseExpiry) Record() tlv.Record {
3✔
26
        return tlv.MakeStaticRecord(
3✔
27
                LeaseExpiryRecordType, l, 4, leaseExpiryEncoder, leaseExpiryDecoder,
3✔
28
        )
3✔
29
}
3✔
30

31
// leaseExpiryEncoder is a custom TLV encoder for the LeaseExpiry record.
32
func leaseExpiryEncoder(w io.Writer, val interface{}, buf *[8]byte) error {
3✔
33
        if v, ok := val.(*LeaseExpiry); ok {
6✔
34
                return tlv.EUint32T(w, uint32(*v), buf)
3✔
35
        }
3✔
36

37
        return tlv.NewTypeForEncodingErr(val, "lnwire.LeaseExpiry")
×
38
}
39

40
// leaseExpiryDecoder is a custom TLV decoder for the LeaseExpiry record.
41
func leaseExpiryDecoder(r io.Reader, val interface{}, buf *[8]byte, l uint64) error {
3✔
42
        if v, ok := val.(*LeaseExpiry); ok {
6✔
43
                var leaseExpiry uint32
3✔
44
                if err := tlv.DUint32(r, &leaseExpiry, buf, l); err != nil {
3✔
UNCOV
45
                        return err
×
UNCOV
46
                }
×
47
                *v = LeaseExpiry(leaseExpiry)
3✔
48
                return nil
3✔
49
        }
50

51
        return tlv.NewTypeForEncodingErr(val, "lnwire.LeaseExpiry")
×
52
}
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