• 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

12.5
/watchtower/conf.go
1
package watchtower
2

3
import (
4
        "strconv"
5
        "time"
6
)
7

8
// Conf specifies the watchtower options that can be configured from the command
9
// line or configuration file.
10
type Conf struct {
11
        // RawListeners configures the watchtower's listening ports/interfaces.
12
        RawListeners []string `long:"listen" description:"Add interfaces/ports to listen for peer connections"`
13

14
        // RawExternalIPs configures the watchtower's external ports/interfaces.
15
        RawExternalIPs []string `long:"externalip" description:"Add interfaces/ports where the watchtower can accept peer connections"`
16

17
        // ReadTimeout specifies the duration the tower will wait when trying to
18
        // read a message from a client before hanging up.
19
        ReadTimeout time.Duration `long:"readtimeout" description:"Duration the watchtower server will wait for messages to be received before hanging up on clients"`
20

21
        // WriteTimeout specifies the duration the tower will wait when trying
22
        // to write a message from a client before hanging up.
23
        WriteTimeout time.Duration `long:"writetimeout" description:"Duration the watchtower server will wait for messages to be written before hanging up on client connections"`
24
}
25

26
// DefaultConf returns a Conf with some default values filled in.
27
func DefaultConf() *Conf {
1✔
28
        return &Conf{
1✔
29
                ReadTimeout:  DefaultReadTimeout,
1✔
30
                WriteTimeout: DefaultWriteTimeout,
1✔
31
        }
1✔
32
}
1✔
33

34
// Apply completes the passed Config struct by applying any parsed Conf options.
35
// If the corresponding values parsed by Conf are already set in the Config,
36
// those fields will be not be modified.
37
func (c *Conf) Apply(cfg *Config,
UNCOV
38
        normalizer AddressNormalizer) (*Config, error) {
×
UNCOV
39

×
UNCOV
40
        // Set the Config's listening addresses if they are empty.
×
UNCOV
41
        if cfg.ListenAddrs == nil {
×
UNCOV
42
                // Without a network, we will be unable to resolve the listening
×
UNCOV
43
                // addresses.
×
UNCOV
44
                if cfg.Net == nil {
×
45
                        return nil, ErrNoNetwork
×
46
                }
×
47

48
                // If no addresses are specified by the Config, we will resort
49
                // to the default peer port.
UNCOV
50
                if len(c.RawListeners) == 0 {
×
51
                        addr := DefaultListenAddr
×
52
                        c.RawListeners = append(c.RawListeners, addr)
×
53
                }
×
54

55
                // Normalize the raw listening addresses so that they can be
56
                // used by the brontide listener.
UNCOV
57
                var err error
×
UNCOV
58
                cfg.ListenAddrs, err = normalizer(
×
UNCOV
59
                        c.RawListeners, strconv.Itoa(DefaultPeerPort),
×
UNCOV
60
                        cfg.Net.ResolveTCPAddr,
×
UNCOV
61
                )
×
UNCOV
62
                if err != nil {
×
63
                        return nil, err
×
64
                }
×
65
        }
66

67
        // Set the Config's external ips if they are empty.
UNCOV
68
        if cfg.ExternalIPs == nil {
×
UNCOV
69
                // Without a network, we will be unable to resolve the external
×
UNCOV
70
                // IP addresses.
×
UNCOV
71
                if cfg.Net == nil {
×
72
                        return nil, ErrNoNetwork
×
73
                }
×
74

UNCOV
75
                var err error
×
UNCOV
76
                cfg.ExternalIPs, err = normalizer(
×
UNCOV
77
                        c.RawExternalIPs, strconv.Itoa(DefaultPeerPort),
×
UNCOV
78
                        cfg.Net.ResolveTCPAddr,
×
UNCOV
79
                )
×
UNCOV
80
                if err != nil {
×
81
                        return nil, err
×
82
                }
×
83
        }
84

85
        // If the Config has no read timeout, we will use the parsed Conf
86
        // value.
UNCOV
87
        if cfg.ReadTimeout == 0 && c.ReadTimeout != 0 {
×
UNCOV
88
                cfg.ReadTimeout = c.ReadTimeout
×
UNCOV
89
        }
×
90

91
        // If the Config has no write timeout, we will use the parsed Conf
92
        // value.
UNCOV
93
        if cfg.WriteTimeout == 0 && c.WriteTimeout != 0 {
×
UNCOV
94
                cfg.WriteTimeout = c.WriteTimeout
×
UNCOV
95
        }
×
96

UNCOV
97
        return cfg, nil
×
98
}
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