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

lightningnetwork / lnd / 13236757158

10 Feb 2025 08:39AM UTC coverage: 57.649% (-1.2%) from 58.815%
13236757158

Pull #9493

github

ziggie1984
lncli: for some cmds we don't replace the data of the response.

For some cmds it is not very practical to replace the json output
because we might pipe it into other commands. For example when
creating the route we want to pipe it into sendtoRoute.
Pull Request #9493: For some lncli cmds we should not replace the content with other data

0 of 9 new or added lines in 2 files covered. (0.0%)

19535 existing lines in 252 files now uncovered.

103517 of 179563 relevant lines covered (57.65%)

24878.49 hits per line

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

0.0
/lncfg/caches.go
1
package lncfg
2

3
import (
4
        "fmt"
5
        "time"
6
)
7

8
const (
9
        // MinRejectCacheSize is a floor on the maximum capacity allowed for
10
        // channeldb's reject cache. This amounts to roughly 125 KB when full.
11
        MinRejectCacheSize = 5000
12

13
        // MinChannelCacheSize is a floor on the maximum capacity allowed for
14
        // channeldb's channel cache. This amounts to roughly 2 MB when full.
15
        MinChannelCacheSize = 1000
16

17
        // DefaultRPCGraphCacheDuration is the default interval that the RPC
18
        // response to DescribeGraph should be cached for.
19
        DefaultRPCGraphCacheDuration = time.Minute
20
)
21

22
// Caches holds the configuration for various caches within lnd.
23
//
24
//nolint:ll
25
type Caches struct {
26
        // RejectCacheSize is the maximum number of entries stored in lnd's
27
        // reject cache, which is used for efficiently rejecting gossip updates.
28
        // Memory usage is roughly 25b per entry.
29
        RejectCacheSize int `long:"reject-cache-size" description:"Maximum number of entries contained in the reject cache, which is used to speed up filtering of new channel announcements and channel updates from peers. Each entry requires 25 bytes."`
30

31
        // ChannelCacheSize is the maximum number of entries stored in lnd's
32
        // channel cache, which is used reduce memory allocations in reply to
33
        // peers querying for gossip traffic. Memory usage is roughly 2Kb per
34
        // entry.
35
        ChannelCacheSize int `long:"channel-cache-size" description:"Maximum number of entries contained in the channel cache, which is used to reduce memory allocations from gossip queries from peers. Each entry requires roughly 2Kb."`
36

37
        // RPCGraphCacheDuration is used to control the flush interval of the
38
        // channel graph cache.
39
        RPCGraphCacheDuration time.Duration `long:"rpc-graph-cache-duration" description:"The period of time expressed as a duration (1s, 1m, 1h, etc) that the RPC response to DescribeGraph should be cached for."`
40
}
41

42
// Validate checks the Caches configuration for values that are too small to be
43
// sane.
UNCOV
44
func (c *Caches) Validate() error {
×
UNCOV
45
        if c.RejectCacheSize < MinRejectCacheSize {
×
46
                return fmt.Errorf("reject cache size %d is less than min: %d",
×
47
                        c.RejectCacheSize, MinRejectCacheSize)
×
48
        }
×
UNCOV
49
        if c.ChannelCacheSize < MinChannelCacheSize {
×
50
                return fmt.Errorf("channel cache size %d is less than min: %d",
×
51
                        c.ChannelCacheSize, MinChannelCacheSize)
×
52
        }
×
53

UNCOV
54
        return nil
×
55
}
56

57
// Compile-time constraint to ensure Caches implements the Validator interface.
58
var _ Validator = (*Caches)(nil)
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