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

lightningnetwork / lnd / 13440912774

20 Feb 2025 05:14PM UTC coverage: 57.697% (-1.1%) from 58.802%
13440912774

Pull #9535

github

guggero
GitHub: remove duplicate caching

Turns out that actions/setup-go starting with @v4 also adds caching.
With that, our cache size on disk has almost doubled, leading to the
GitHub runner running out of space in certain situation.
We fix that by disabling the automated caching since we already have our
own, custom-tailored version.
Pull Request #9535: GitHub: remove duplicate caching

103519 of 179417 relevant lines covered (57.7%)

24825.3 hits per line

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

50.0
/lncfg/wtclient.go
1
package lncfg
2

3
import (
4
        "fmt"
5

6
        "github.com/lightningnetwork/lnd/watchtower/wtclient"
7
        "github.com/lightningnetwork/lnd/watchtower/wtpolicy"
8
)
9

10
// WtClient holds the configuration options for the daemon's watchtower client.
11
//
12
//nolint:ll
13
type WtClient struct {
14
        // Active determines whether a watchtower client should be created to
15
        // back up channel states with registered watchtowers.
16
        Active bool `long:"active" description:"Whether the daemon should use private watchtowers to back up revoked channel states."`
17

18
        // SweepFeeRate specifies the fee rate in sat/byte to be used when
19
        // constructing justice transactions sent to the tower.
20
        SweepFeeRate uint64 `long:"sweep-fee-rate" description:"Specifies the fee rate in sat/byte to be used when constructing justice transactions sent to the watchtower."`
21

22
        // SessionCloseRange is the range over which to choose a random number
23
        // of blocks to wait after the last channel of a session is closed
24
        // before sending the DeleteSession message to the tower server.
25
        SessionCloseRange uint32 `long:"session-close-range" description:"The range over which to choose a random number of blocks to wait after the last channel of a session is closed before sending the DeleteSession message to the tower server. Set to 1 for no delay."`
26

27
        // MaxTasksInMemQueue is the maximum number of back-up tasks that should
28
        // be queued in memory before overflowing to disk.
29
        MaxTasksInMemQueue uint64 `long:"max-tasks-in-mem-queue" description:"The maximum number of updates that should be queued in memory before overflowing to disk."`
30

31
        // MaxUpdates is the maximum number of updates to be backed up in a
32
        // single tower sessions.
33
        MaxUpdates uint16 `long:"max-updates" description:"The maximum number of updates to be backed up in a single session."`
34
}
35

36
// DefaultWtClientCfg returns the WtClient config struct with some default
37
// values populated.
38
func DefaultWtClientCfg() *WtClient {
1✔
39
        // The sweep fee rate used internally by the tower client is in sats/kw
1✔
40
        // but the config exposed to the user is in sats/byte, so we convert the
1✔
41
        // default here before exposing it to the user.
1✔
42
        sweepSatsPerVB := wtpolicy.DefaultSweepFeeRate.FeePerVByte()
1✔
43
        sweepFeeRate := uint64(sweepSatsPerVB)
1✔
44

1✔
45
        return &WtClient{
1✔
46
                SweepFeeRate:       sweepFeeRate,
1✔
47
                SessionCloseRange:  wtclient.DefaultSessionCloseRange,
1✔
48
                MaxTasksInMemQueue: wtclient.DefaultMaxTasksInMemQueue,
1✔
49
                MaxUpdates:         wtpolicy.DefaultMaxUpdates,
1✔
50
        }
1✔
51
}
1✔
52

53
// Validate ensures the user has provided a valid configuration.
54
//
55
// NOTE: Part of the Validator interface.
56
func (c *WtClient) Validate() error {
×
57
        if c.SweepFeeRate == 0 {
×
58
                return fmt.Errorf("sweep-fee-rate must be non-zero")
×
59
        }
×
60

61
        if c.MaxUpdates == 0 {
×
62
                return fmt.Errorf("max-updates must be non-zero")
×
63
        }
×
64

65
        if c.MaxTasksInMemQueue == 0 {
×
66
                return fmt.Errorf("max-tasks-in-mem-queue must be non-zero")
×
67
        }
×
68

69
        if c.SessionCloseRange == 0 {
×
70
                return fmt.Errorf("session-close-range must be non-zero")
×
71
        }
×
72

73
        return nil
×
74
}
75

76
// Compile-time constraint to ensure WtClient implements the Validator
77
// interface.
78
var _ Validator = (*WtClient)(nil)
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