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

3
import (
4
        "fmt"
5
        "time"
6

7
        "github.com/lightningnetwork/lnd/discovery"
8
        "github.com/lightningnetwork/lnd/routing/route"
9
)
10

11
// minAnnouncementConf defines the minimal num of confs needed for the config
12
// AnnouncementConf. We choose 3 here as it's unlikely a reorg depth of 3 would
13
// happen.
14
//
15
// NOTE: The specs recommends setting this value to 6, which is the default
16
// value used for AnnouncementConf. However the receiver should be able to
17
// decide which channels to be included in its local graph, more details can be
18
// found:
19
// - https://github.com/lightning/bolts/pull/1215#issuecomment-2557337202
20
const minAnnouncementConf = 3
21

22
//nolint:ll
23
type Gossip struct {
24
        PinnedSyncersRaw []string `long:"pinned-syncers" description:"A set of peers that should always remain in an active sync state, which can be used to closely synchronize the routing tables of two nodes. The value should be a hex-encoded pubkey, the flag can be specified multiple times to add multiple peers. Connected peers matching this pubkey will remain active for the duration of the connection and not count towards the NumActiveSyncer count."`
25

26
        PinnedSyncers discovery.PinnedSyncers
27

28
        MaxChannelUpdateBurst int `long:"max-channel-update-burst" description:"The maximum number of updates for a specific channel and direction that lnd will accept over the channel update interval."`
29

30
        ChannelUpdateInterval time.Duration `long:"channel-update-interval" description:"The interval used to determine how often lnd should allow a burst of new updates for a specific channel and direction."`
31

32
        SubBatchDelay time.Duration `long:"sub-batch-delay" description:"The duration to wait before sending the next announcement batch if there are multiple. Use a small value if there are a lot announcements and they need to be broadcast quickly."`
33

34
        AnnouncementConf uint32 `long:"announcement-conf" description:"The number of confirmations required before processing channel announcements."`
35
}
36

37
// Parse the pubkeys for the pinned syncers.
UNCOV
38
func (g *Gossip) Parse() error {
×
UNCOV
39
        pinnedSyncers := make(discovery.PinnedSyncers)
×
UNCOV
40
        for _, pubkeyStr := range g.PinnedSyncersRaw {
×
UNCOV
41
                vertex, err := route.NewVertexFromStr(pubkeyStr)
×
UNCOV
42
                if err != nil {
×
43
                        return err
×
44
                }
×
UNCOV
45
                pinnedSyncers[vertex] = struct{}{}
×
46
        }
47

UNCOV
48
        g.PinnedSyncers = pinnedSyncers
×
UNCOV
49

×
UNCOV
50
        return nil
×
51
}
52

53
// Validate checks the Gossip configuration to ensure that the input values are
54
// sane.
UNCOV
55
func (g *Gossip) Validate() error {
×
UNCOV
56
        if g.AnnouncementConf < minAnnouncementConf {
×
57
                return fmt.Errorf("announcement-conf=%v must be no less than "+
×
58
                        "%v", g.AnnouncementConf, minAnnouncementConf)
×
59
        }
×
60

UNCOV
61
        return nil
×
62
}
63

64
// Compile-time constraint to ensure Gossip implements the Validator interface.
65
var _ Validator = (*Gossip)(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