• 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
/lncfg/invoices.go
1
package lncfg
2

3
const (
4
        // DefaultHoldInvoiceExpiryDelta defines the number of blocks before the
5
        // expiry height of a hold invoice's htlc that lnd will automatically
6
        // cancel the invoice to prevent the channel from force closing. This
7
        // value *must* be greater than DefaultIncomingBroadcastDelta to prevent
8
        // force closes.
9
        DefaultHoldInvoiceExpiryDelta = DefaultIncomingBroadcastDelta + 2
10

11
        // DefaultMinNumRealBlindedPathHops is the minimum number of _real_
12
        // hops to include in a blinded payment path. This doesn't include our
13
        // node (the destination node), so if the minimum is 1, then the path
14
        // will contain at minimum our node along with an introduction node hop.
15
        DefaultMinNumRealBlindedPathHops = 1
16

17
        // DefaultNumBlindedPathHops is the number of hops to include in a
18
        // blinded payment path. If paths shorter than this number are found,
19
        // then dummy hops are used to pad the path to this length.
20
        DefaultNumBlindedPathHops = 2
21

22
        // DefaultMaxNumBlindedPaths is the maximum number of different blinded
23
        // payment paths to include in an invoice.
24
        DefaultMaxNumBlindedPaths = 3
25

26
        // DefaultBlindedPathPolicyIncreaseMultiplier is the default multiplier
27
        // used to increase certain blinded hop policy values in order to add
28
        // a probing buffer.
29
        DefaultBlindedPathPolicyIncreaseMultiplier = 1.1
30

31
        // DefaultBlindedPathPolicyDecreaseMultiplier is the default multiplier
32
        // used to decrease certain blinded hop policy values in order to add a
33
        // probing buffer.
34
        DefaultBlindedPathPolicyDecreaseMultiplier = 0.9
35
)
36

37
// Invoices holds the configuration options for invoices.
38
//
39
//nolint:ll
40
type Invoices struct {
41
        HoldExpiryDelta uint32 `long:"holdexpirydelta" description:"The number of blocks before a hold invoice's htlc expires that the invoice should be canceled to prevent a force close. Force closes will not be prevented if this value is not greater than DefaultIncomingBroadcastDelta."`
42
}
43

44
// Validate checks that the various invoice config options are sane.
45
//
46
// NOTE: this is part of the Validator interface.
UNCOV
47
func (i *Invoices) Validate() error {
×
UNCOV
48
        // Log a warning if our expiry delta is not greater than our incoming
×
UNCOV
49
        // broadcast delta. We do not fail here because this value may be set
×
UNCOV
50
        // to zero to intentionally keep lnd's behavior unchanged from when we
×
UNCOV
51
        // didn't auto-cancel these invoices.
×
UNCOV
52
        if i.HoldExpiryDelta <= DefaultIncomingBroadcastDelta {
×
53
                log.Warnf("Invoice hold expiry delta: %v <= incoming "+
×
54
                        "delta: %v, accepted hold invoices will force close "+
×
55
                        "channels if they are not canceled manually",
×
56
                        i.HoldExpiryDelta, DefaultIncomingBroadcastDelta)
×
57
        }
×
58

UNCOV
59
        return nil
×
60
}
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