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

lightningnetwork / lnd / 16181619122

09 Jul 2025 10:33PM UTC coverage: 55.326% (-2.3%) from 57.611%
16181619122

Pull #10060

github

web-flow
Merge d15e8671f into 0e830da9d
Pull Request #10060: sweep: fix expected spending events being missed

9 of 26 new or added lines in 2 files covered. (34.62%)

23695 existing lines in 280 files now uncovered.

108518 of 196143 relevant lines covered (55.33%)

22354.81 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
        // ForEachNodeDirectedChannel calls the callback for every channel of
16
        // the given node.
17
        ForEachNodeDirectedChannel(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 gain access to a graphdb.NodeTraverser
25
// instance which can then be used for a path-finding session. Depending on the
26
// implementation, the session will represent a DB connection where a read-lock
27
// is being held across calls to the backing graph.
28
type GraphSessionFactory interface {
29
        // GraphSession will provide the call-back with access to a
30
        // graphdb.NodeTraverser instance which can be used to perform queries
31
        // against the channel graph.
32
        GraphSession(cb func(graph graphdb.NodeTraverser) error) error
33
}
34

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

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

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

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

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

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