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

lightningnetwork / lnd / 11216766535

07 Oct 2024 01:37PM UTC coverage: 57.817% (-1.0%) from 58.817%
11216766535

Pull #9148

github

ProofOfKeags
lnwire: remove kickoff feerate from propose/commit
Pull Request #9148: DynComms [2/n]: lnwire: add authenticated wire messages for Dyn*

571 of 879 new or added lines in 16 files covered. (64.96%)

23253 existing lines in 251 files now uncovered.

99022 of 171268 relevant lines covered (57.82%)

38420.67 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:lll
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.
UNCOV
56
func (c *WtClient) Validate() error {
×
UNCOV
57
        if c.SweepFeeRate == 0 {
×
58
                return fmt.Errorf("sweep-fee-rate must be non-zero")
×
59
        }
×
60

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

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

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

UNCOV
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