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

lightningnetwork / lnd / 13412100018

19 Feb 2025 12:05PM UTC coverage: 44.914% (-13.9%) from 58.794%
13412100018

Pull #9521

github

web-flow
Merge 861d6970e into 0e8786348
Pull Request #9521: unit: remove GOACC, use Go 1.20 native coverage functionality

101023 of 224923 relevant lines covered (44.91%)

19479.4 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.
38
func (g *Gossip) Parse() error {
×
39
        pinnedSyncers := make(discovery.PinnedSyncers)
×
40
        for _, pubkeyStr := range g.PinnedSyncersRaw {
×
41
                vertex, err := route.NewVertexFromStr(pubkeyStr)
×
42
                if err != nil {
×
43
                        return err
×
44
                }
×
45
                pinnedSyncers[vertex] = struct{}{}
×
46
        }
47

48
        g.PinnedSyncers = pinnedSyncers
×
49

×
50
        return nil
×
51
}
52

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

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