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

lightningnetwork / lnd / 12986279612

27 Jan 2025 09:51AM UTC coverage: 57.652% (-1.1%) from 58.788%
12986279612

Pull #9447

github

yyforyongyu
sweep: rename methods for clarity

We now rename "third party" to "unknown" as the inputs can be spent via
an older sweeping tx, a third party (anchor), or a remote party (pin).
In fee bumper we don't have the info to distinguish the above cases, and
leave them to be further handled by the sweeper as it has more context.
Pull Request #9447: sweep: start tracking input spending status in the fee bumper

83 of 87 new or added lines in 2 files covered. (95.4%)

19578 existing lines in 256 files now uncovered.

103448 of 179434 relevant lines covered (57.65%)

24884.58 hits per line

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

44.83
/graph/db/options.go
1
package graphdb
2

3
import "time"
4

5
const (
6
        // DefaultRejectCacheSize is the default number of rejectCacheEntries to
7
        // cache for use in the rejection cache of incoming gossip traffic. This
8
        // produces a cache size of around 1MB.
9
        DefaultRejectCacheSize = 50000
10

11
        // DefaultChannelCacheSize is the default number of ChannelEdges cached
12
        // in order to reply to gossip queries. This produces a cache size of
13
        // around 40MB.
14
        DefaultChannelCacheSize = 20000
15

16
        // DefaultPreAllocCacheNumNodes is the default number of channels we
17
        // assume for mainnet for pre-allocating the graph cache. As of
18
        // September 2021, there currently are 14k nodes in a strictly pruned
19
        // graph, so we choose a number that is slightly higher.
20
        DefaultPreAllocCacheNumNodes = 15000
21
)
22

23
// Options holds parameters for tuning and customizing a graph.DB.
24
type Options struct {
25
        // RejectCacheSize is the maximum number of rejectCacheEntries to hold
26
        // in the rejection cache.
27
        RejectCacheSize int
28

29
        // ChannelCacheSize is the maximum number of ChannelEdges to hold in the
30
        // channel cache.
31
        ChannelCacheSize int
32

33
        // BatchCommitInterval is the maximum duration the batch schedulers will
34
        // wait before attempting to commit a pending set of updates.
35
        BatchCommitInterval time.Duration
36

37
        // PreAllocCacheNumNodes is the number of nodes we expect to be in the
38
        // graph cache, so we can pre-allocate the map accordingly.
39
        PreAllocCacheNumNodes int
40

41
        // UseGraphCache denotes whether the in-memory graph cache should be
42
        // used or a fallback version that uses the underlying database for
43
        // path finding.
44
        UseGraphCache bool
45

46
        // NoMigration specifies that underlying backend was opened in read-only
47
        // mode and migrations shouldn't be performed. This can be useful for
48
        // applications that use the channeldb package as a library.
49
        NoMigration bool
50
}
51

52
// DefaultOptions returns an Options populated with default values.
53
func DefaultOptions() *Options {
212✔
54
        return &Options{
212✔
55
                RejectCacheSize:       DefaultRejectCacheSize,
212✔
56
                ChannelCacheSize:      DefaultChannelCacheSize,
212✔
57
                PreAllocCacheNumNodes: DefaultPreAllocCacheNumNodes,
212✔
58
                UseGraphCache:         true,
212✔
59
                NoMigration:           false,
212✔
60
        }
212✔
61
}
212✔
62

63
// OptionModifier is a function signature for modifying the default Options.
64
type OptionModifier func(*Options)
65

66
// WithRejectCacheSize sets the RejectCacheSize to n.
UNCOV
67
func WithRejectCacheSize(n int) OptionModifier {
×
UNCOV
68
        return func(o *Options) {
×
UNCOV
69
                o.RejectCacheSize = n
×
UNCOV
70
        }
×
71
}
72

73
// WithChannelCacheSize sets the ChannelCacheSize to n.
UNCOV
74
func WithChannelCacheSize(n int) OptionModifier {
×
UNCOV
75
        return func(o *Options) {
×
UNCOV
76
                o.ChannelCacheSize = n
×
UNCOV
77
        }
×
78
}
79

80
// WithPreAllocCacheNumNodes sets the PreAllocCacheNumNodes to n.
81
func WithPreAllocCacheNumNodes(n int) OptionModifier {
×
82
        return func(o *Options) {
×
83
                o.PreAllocCacheNumNodes = n
×
84
        }
×
85
}
86

87
// WithBatchCommitInterval sets the batch commit interval for the interval batch
88
// schedulers.
UNCOV
89
func WithBatchCommitInterval(interval time.Duration) OptionModifier {
×
UNCOV
90
        return func(o *Options) {
×
UNCOV
91
                o.BatchCommitInterval = interval
×
UNCOV
92
        }
×
93
}
94

95
// WithUseGraphCache sets the UseGraphCache option to the given value.
96
func WithUseGraphCache(use bool) OptionModifier {
103✔
97
        return func(o *Options) {
206✔
98
                o.UseGraphCache = use
103✔
99
        }
103✔
100
}
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