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

lightningnetwork / lnd / 13536249039

26 Feb 2025 03:42AM UTC coverage: 57.462% (-1.4%) from 58.835%
13536249039

Pull #8453

github

Roasbeef
peer: update chooseDeliveryScript to gen script if needed

In this commit, we update `chooseDeliveryScript` to generate a new
script if needed. This allows us to fold in a few other lines that
always followed this function into this expanded function.

The tests have been updated accordingly.
Pull Request #8453: [4/4] - multi: integrate new rbf coop close FSM into the existing peer flow

275 of 1318 new or added lines in 22 files covered. (20.86%)

19521 existing lines in 257 files now uncovered.

103858 of 180741 relevant lines covered (57.46%)

24750.23 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