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

lightningnetwork / lnd / 13157733617

05 Feb 2025 12:49PM UTC coverage: 57.712% (-1.1%) from 58.82%
13157733617

Pull #9447

github

yyforyongyu
sweep: rename methods for clarity

We now rename "third party" to "unknown" as the inputs can be spent via
an older sweeping tx, a third party (anchor), or a remote party (pin).
In fee bumper we don't have the info to distinguish the above cases, and
leave them to be further handled by the sweeper as it has more context.
Pull Request #9447: sweep: start tracking input spending status in the fee bumper

83 of 87 new or added lines in 2 files covered. (95.4%)

19472 existing lines in 252 files now uncovered.

103634 of 179570 relevant lines covered (57.71%)

24840.31 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,
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