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

lightningnetwork / lnd / 11216766535

07 Oct 2024 01:37PM UTC coverage: 57.817% (-1.0%) from 58.817%
11216766535

Pull #9148

github

ProofOfKeags
lnwire: remove kickoff feerate from propose/commit
Pull Request #9148: DynComms [2/n]: lnwire: add authenticated wire messages for Dyn*

571 of 879 new or added lines in 16 files covered. (64.96%)

23253 existing lines in 251 files now uncovered.

99022 of 171268 relevant lines covered (57.82%)

38420.67 hits per line

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

79.49
/graph/stats.go
1
package graph
2

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

9
// routerStats is a struct that tracks various updates to the graph and
10
// facilitates aggregate logging of the statistics.
11
type routerStats struct {
12
        numChannels uint32
13
        numUpdates  uint32
14
        numNodes    uint32
15
        lastReset   time.Time
16

17
        mu sync.RWMutex
18
}
19

20
// incNumEdges increments the number of discovered edges.
21
func (g *routerStats) incNumEdgesDiscovered() {
14✔
22
        g.mu.Lock()
14✔
23
        g.numChannels++
14✔
24
        g.mu.Unlock()
14✔
25
}
14✔
26

27
// incNumUpdates increments the number of channel updates processed.
28
func (g *routerStats) incNumChannelUpdates() {
5✔
29
        g.mu.Lock()
5✔
30
        g.numUpdates++
5✔
31
        g.mu.Unlock()
5✔
32
}
5✔
33

34
// incNumNodeUpdates increments the number of node updates processed.
35
func (g *routerStats) incNumNodeUpdates() {
6✔
36
        g.mu.Lock()
6✔
37
        g.numNodes++
6✔
38
        g.mu.Unlock()
6✔
39
}
6✔
40

41
// Empty returns true if all stats are zero.
42
func (g *routerStats) Empty() bool {
130✔
43
        g.mu.RLock()
130✔
44
        isEmpty := g.numChannels == 0 &&
130✔
45
                g.numUpdates == 0 &&
130✔
46
                g.numNodes == 0
130✔
47
        g.mu.RUnlock()
130✔
48
        return isEmpty
130✔
49
}
130✔
50

51
// Reset clears any router stats and sets the lastReset field to now.
52
func (g *routerStats) Reset() {
21✔
53
        g.mu.Lock()
21✔
54
        g.numChannels = 0
21✔
55
        g.numUpdates = 0
21✔
56
        g.numNodes = 0
21✔
57
        g.lastReset = time.Now()
21✔
58
        g.mu.Unlock()
21✔
59
}
21✔
60

61
// String returns a human-readable description of the router stats.
UNCOV
62
func (g *routerStats) String() string {
×
UNCOV
63
        g.mu.RLock()
×
UNCOV
64
        str := fmt.Sprintf("Processed channels=%d updates=%d nodes=%d in "+
×
UNCOV
65
                "last %v", g.numChannels, g.numUpdates, g.numNodes,
×
UNCOV
66
                time.Since(g.lastReset))
×
UNCOV
67
        g.mu.RUnlock()
×
UNCOV
68
        return str
×
UNCOV
69
}
×
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