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

lightningnetwork / lnd / 12986279612

27 Jan 2025 09:51AM UTC coverage: 57.652% (-1.1%) from 58.788%
12986279612

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%)

19578 existing lines in 256 files now uncovered.

103448 of 179434 relevant lines covered (57.65%)

24884.58 hits per line

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

0.0
/zpay32/hophint.go
1
package zpay32
2

3
import (
4
        "github.com/btcsuite/btcd/btcec/v2"
5
        "github.com/lightningnetwork/lnd/lnwire"
6
)
7

8
const (
9
        // DefaultAssumedFinalCLTVDelta is the default value to be used as the
10
        // final CLTV delta for a route if one is unspecified in the payment
11
        // request.
12
        // We adhere to the recommendation in BOLT 02 for terminal payments.
13
        // See also:
14
        // https://github.com/lightning/bolts/blob/master/02-peer-protocol.md
15
        DefaultAssumedFinalCLTVDelta = 18
16

17
        // feeRateParts is the total number of parts used to express fee rates.
18
        feeRateParts = 1e6
19
)
20

21
// HopHint is a routing hint that contains the minimum information of a channel
22
// required for an intermediate hop in a route to forward the payment to the
23
// next. This should be ideally used for private channels, since they are not
24
// publicly advertised to the network for routing.
25
type HopHint struct {
26
        // NodeID is the public key of the node at the start of the channel.
27
        NodeID *btcec.PublicKey
28

29
        // ChannelID is the unique identifier of the channel.
30
        ChannelID uint64
31

32
        // FeeBaseMSat is the base fee of the channel in millisatoshis.
33
        FeeBaseMSat uint32
34

35
        // FeeProportionalMillionths is the fee rate, in millionths of a
36
        // satoshi, for every satoshi sent through the channel.
37
        FeeProportionalMillionths uint32
38

39
        // CLTVExpiryDelta is the time-lock delta of the channel.
40
        CLTVExpiryDelta uint16
41
}
42

43
// Copy returns a deep copy of the hop hint.
44
func (h HopHint) Copy() HopHint {
×
45
        nodeID := *h.NodeID
×
46
        return HopHint{
×
47
                NodeID:                    &nodeID,
×
48
                ChannelID:                 h.ChannelID,
×
49
                FeeBaseMSat:               h.FeeBaseMSat,
×
50
                FeeProportionalMillionths: h.FeeProportionalMillionths,
×
51
                CLTVExpiryDelta:           h.CLTVExpiryDelta,
×
52
        }
×
53
}
×
54

55
// HopFee calculates the fee for a given amount that is forwarded over a hop.
56
// The amount has to be denoted in milli satoshi. The returned fee is also
57
// denoted in milli satoshi.
UNCOV
58
func (h HopHint) HopFee(amt lnwire.MilliSatoshi) lnwire.MilliSatoshi {
×
UNCOV
59
        baseFee := lnwire.MilliSatoshi(h.FeeBaseMSat)
×
UNCOV
60
        feeRate := lnwire.MilliSatoshi(h.FeeProportionalMillionths)
×
UNCOV
61

×
UNCOV
62
        return baseFee + (amt*feeRate)/feeRateParts
×
UNCOV
63
}
×
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