• 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

0.0
/routing/graph.go
1
package routing
2

3
import (
4
        "fmt"
5

6
        "github.com/btcsuite/btcd/btcutil"
7
        "github.com/lightningnetwork/lnd/channeldb"
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 *channeldb.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,
UNCOV
39
        amount lnwire.MilliSatoshi) (btcutil.Amount, error) {
×
UNCOV
40

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

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

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

UNCOV
58
        edge := edgeUnifier.getEdgeNetwork(amount, 0)
×
UNCOV
59
        if edge == nil {
×
UNCOV
60
                return 0, fmt.Errorf("no edge for node pair %v -> %v "+
×
UNCOV
61
                        "(amount %v)", nodeFrom, nodeTo, amount)
×
UNCOV
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