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

lightningnetwork / lnd / 16298099473

15 Jul 2025 03:51PM UTC coverage: 55.226% (-12.1%) from 67.338%
16298099473

Pull #10080

github

web-flow
Merge 00914431e into df6c02e3a
Pull Request #10080: sqldb+graph/db: prefix graph SQL objects with "graph_"

0 of 211 new or added lines in 3 files covered. (0.0%)

23795 existing lines in 293 files now uncovered.

108588 of 196626 relevant lines covered (55.23%)

22290.63 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/lnwire"
9
        "github.com/lightningnetwork/lnd/routing/route"
10
)
11

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

23
//nolint:ll
24
type Gossip struct {
25
        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."`
26

27
        PinnedSyncers discovery.PinnedSyncers
28

29
        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."`
30

31
        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."`
32

33
        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."`
34

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

37
        MsgRateBytes uint64 `long:"msg-rate-bytes" description:"The maximum number of bytes of gossip messages that will be sent per second. This is a global limit that applies to all peers."`
38

39
        MsgBurstBytes uint64 `long:"msg-burst-bytes" description:"The maximum number of bytes of gossip messages that will be sent in a burst. This is a global limit that applies to all peers. This value should be set to something greater than 130 KB"`
40
}
41

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

UNCOV
53
        g.PinnedSyncers = pinnedSyncers
×
UNCOV
54

×
UNCOV
55
        return nil
×
56
}
57

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

UNCOV
66
        if g.MsgBurstBytes < lnwire.MaxSliceLength {
×
67
                return fmt.Errorf("msg-burst-bytes=%v must be at least %v",
×
68
                        g.MsgBurstBytes, lnwire.MaxSliceLength)
×
69
        }
×
70

UNCOV
71
        return nil
×
72
}
73

74
// Compile-time constraint to ensure Gossip implements the Validator interface.
75
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