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

lightningnetwork / lnd / 12293715361

12 Dec 2024 09:38AM UTC coverage: 57.483% (+7.9%) from 49.538%
12293715361

Pull #9348

github

ziggie1984
github: update goveralls tool

The goverall tool had a bug regarding the module versioning of
golang packages see also
https://github.com/mattn/goveralls/pull/222 for more background.
Goveralls is wrapped by another library to make it available for
github actions. So the relevant PR which is referenced here in
LND is:
https://github.com/shogo82148/actions-goveralls/pull/521.
Pull Request #9348: github: update goveralls tool

101897 of 177264 relevant lines covered (57.48%)

24982.4 hits per line

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

0.0
/routing/graph.go
1
package routing
2

3
import (
4
        "fmt"
5

6
        "github.com/btcsuite/btcd/btcutil"
7
        graphdb "github.com/lightningnetwork/lnd/graph/db"
8
        "github.com/lightningnetwork/lnd/lnwire"
9
        "github.com/lightningnetwork/lnd/routing/route"
10
)
11

12
// Graph is an abstract interface that provides information about nodes and
13
// edges to pathfinding.
14
type Graph interface {
15
        // ForEachNodeChannel calls the callback for every channel of the given
16
        // node.
17
        ForEachNodeChannel(nodePub route.Vertex,
18
                cb func(channel *graphdb.DirectedChannel) error) error
19

20
        // FetchNodeFeatures returns the features of the given node.
21
        FetchNodeFeatures(nodePub route.Vertex) (*lnwire.FeatureVector, error)
22
}
23

24
// GraphSessionFactory can be used to produce a new Graph instance which can
25
// then be used for a path-finding session. Depending on the implementation,
26
// the Graph session will represent a DB connection where a read-lock is being
27
// held across calls to the backing Graph.
28
type GraphSessionFactory interface {
29
        // NewGraphSession will produce a new Graph to use for a path-finding
30
        // session. It returns the Graph along with a call-back that must be
31
        // called once Graph access is complete. This call-back will close any
32
        // read-only transaction that was created at Graph construction time.
33
        NewGraphSession() (Graph, func() error, error)
34
}
35

36
// FetchAmountPairCapacity determines the maximal public capacity between two
37
// nodes depending on the amount we try to send.
38
func FetchAmountPairCapacity(graph Graph, source, nodeFrom, nodeTo route.Vertex,
39
        amount lnwire.MilliSatoshi) (btcutil.Amount, error) {
×
40

×
41
        // Create unified edges for all incoming connections.
×
42
        //
×
43
        // Note: Inbound fees are not used here because this method is only used
×
44
        // by a deprecated router rpc.
×
45
        u := newNodeEdgeUnifier(source, nodeTo, false, nil)
×
46

×
47
        err := u.addGraphPolicies(graph)
×
48
        if err != nil {
×
49
                return 0, err
×
50
        }
×
51

52
        edgeUnifier, ok := u.edgeUnifiers[nodeFrom]
×
53
        if !ok {
×
54
                return 0, fmt.Errorf("no edge info for node pair %v -> %v",
×
55
                        nodeFrom, nodeTo)
×
56
        }
×
57

58
        edge := edgeUnifier.getEdgeNetwork(amount, 0)
×
59
        if edge == nil {
×
60
                return 0, fmt.Errorf("no edge for node pair %v -> %v "+
×
61
                        "(amount %v)", nodeFrom, nodeTo, amount)
×
62
        }
×
63

64
        return edge.capacity, nil
×
65
}
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