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

lightningnetwork / lnd / 14446551845

14 Apr 2025 01:12PM UTC coverage: 57.404% (-1.2%) from 58.624%
14446551845

push

github

web-flow
Merge pull request #9703 from yyforyongyu/fix-attempt-hash

Patch htlc attempt hash for legacy payments

12 of 26 new or added lines in 1 file covered. (46.15%)

2039 existing lines in 44 files now uncovered.

95138 of 165734 relevant lines covered (57.4%)

0.61 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
// builderStats is a struct that tracks various updates to the graph and
10
// facilitates aggregate logging of the statistics.
11
type builderStats 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 *builderStats) incNumEdgesDiscovered() {
1✔
22
        g.mu.Lock()
1✔
23
        g.numChannels++
1✔
24
        g.mu.Unlock()
1✔
25
}
1✔
26

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

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

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

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

61
// String returns a human-readable description of the stats.
UNCOV
62
func (g *builderStats) 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