config: expose gossip.pinned-syncers for conf
The pinned syncer set is exposed as a comma-separated list of pubkeys.
This commit is contained in:
parent
2371fc5a8e
commit
fcd5cb625a
@ -309,6 +309,8 @@ type Config struct {
|
|||||||
|
|
||||||
Routing *lncfg.Routing `group:"routing" namespace:"routing"`
|
Routing *lncfg.Routing `group:"routing" namespace:"routing"`
|
||||||
|
|
||||||
|
Gossip *lncfg.Gossip `group:"gossip" namespace:"gossip"`
|
||||||
|
|
||||||
Workers *lncfg.Workers `group:"workers" namespace:"workers"`
|
Workers *lncfg.Workers `group:"workers" namespace:"workers"`
|
||||||
|
|
||||||
Caches *lncfg.Caches `group:"caches" namespace:"caches"`
|
Caches *lncfg.Caches `group:"caches" namespace:"caches"`
|
||||||
@ -477,6 +479,7 @@ func DefaultConfig() Config {
|
|||||||
Backoff: defaultTLSBackoff,
|
Backoff: defaultTLSBackoff,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
Gossip: &lncfg.Gossip{},
|
||||||
MaxOutgoingCltvExpiry: htlcswitch.DefaultMaxOutgoingCltvExpiry,
|
MaxOutgoingCltvExpiry: htlcswitch.DefaultMaxOutgoingCltvExpiry,
|
||||||
MaxChannelFeeAllocation: htlcswitch.DefaultMaxLinkFeeAllocation,
|
MaxChannelFeeAllocation: htlcswitch.DefaultMaxLinkFeeAllocation,
|
||||||
MaxCommitFeeRateAnchors: lnwallet.DefaultAnchorsCommitMaxFeeRateSatPerVByte,
|
MaxCommitFeeRateAnchors: lnwallet.DefaultAnchorsCommitMaxFeeRateSatPerVByte,
|
||||||
@ -1289,6 +1292,10 @@ func ValidateConfig(cfg Config, usageMessage string) (*Config, error) {
|
|||||||
maxRemoteHtlcs)
|
maxRemoteHtlcs)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if err := cfg.Gossip.Parse(); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
// Validate the subconfigs for workers, caches, and the tower client.
|
// Validate the subconfigs for workers, caches, and the tower client.
|
||||||
err = lncfg.Validate(
|
err = lncfg.Validate(
|
||||||
cfg.Workers,
|
cfg.Workers,
|
||||||
|
@ -237,6 +237,11 @@ type Config struct {
|
|||||||
// gossip updates to once per RebroadcastInterval for any keep-alive
|
// gossip updates to once per RebroadcastInterval for any keep-alive
|
||||||
// updates, and once per block for other types of updates.
|
// updates, and once per block for other types of updates.
|
||||||
GossipUpdateThrottle bool
|
GossipUpdateThrottle bool
|
||||||
|
|
||||||
|
// PinnedSyncers is a set of peers that will always transition to
|
||||||
|
// ActiveSync upon connection. These peers will never transition to
|
||||||
|
// PassiveSync.
|
||||||
|
PinnedSyncers PinnedSyncers
|
||||||
}
|
}
|
||||||
|
|
||||||
// AuthenticatedGossiper is a subsystem which is responsible for receiving
|
// AuthenticatedGossiper is a subsystem which is responsible for receiving
|
||||||
@ -338,6 +343,7 @@ func New(cfg Config, selfKey *btcec.PublicKey) *AuthenticatedGossiper {
|
|||||||
NumActiveSyncers: cfg.NumActiveSyncers,
|
NumActiveSyncers: cfg.NumActiveSyncers,
|
||||||
IgnoreHistoricalFilters: cfg.IgnoreHistoricalFilters,
|
IgnoreHistoricalFilters: cfg.IgnoreHistoricalFilters,
|
||||||
BestHeight: gossiper.latestHeight,
|
BestHeight: gossiper.latestHeight,
|
||||||
|
PinnedSyncers: cfg.PinnedSyncers,
|
||||||
})
|
})
|
||||||
|
|
||||||
gossiper.reliableSender = newReliableSender(&reliableSenderCfg{
|
gossiper.reliableSender = newReliableSender(&reliableSenderCfg{
|
||||||
|
28
lncfg/gossip.go
Normal file
28
lncfg/gossip.go
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
package lncfg
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/lightningnetwork/lnd/discovery"
|
||||||
|
"github.com/lightningnetwork/lnd/routing/route"
|
||||||
|
)
|
||||||
|
|
||||||
|
type Gossip struct {
|
||||||
|
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 comma separated list of hex-encoded pubkeys. Connected peers matching this pubkey will remain active for the duration of the connection and not count towards the NumActiveSyncer count."`
|
||||||
|
|
||||||
|
PinnedSyncers discovery.PinnedSyncers
|
||||||
|
}
|
||||||
|
|
||||||
|
// Parse the pubkeys for the pinned syncers.
|
||||||
|
func (g *Gossip) Parse() error {
|
||||||
|
pinnedSyncers := make(discovery.PinnedSyncers)
|
||||||
|
for _, pubkeyStr := range g.PinnedSyncersRaw {
|
||||||
|
vertex, err := route.NewVertexFromStr(pubkeyStr)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
pinnedSyncers[vertex] = struct{}{}
|
||||||
|
}
|
||||||
|
|
||||||
|
g.PinnedSyncers = pinnedSyncers
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
@ -1019,3 +1019,20 @@ litecoin.node=ltcd
|
|||||||
|
|
||||||
; Specify the timeout to be used when opening the database.
|
; Specify the timeout to be used when opening the database.
|
||||||
; db.bolt.dbtimeout=60s
|
; db.bolt.dbtimeout=60s
|
||||||
|
|
||||||
|
[gossip]
|
||||||
|
; Specify a set of pinned gossip syncers, which will always be actively syncing
|
||||||
|
; whenever the corresponding peer is online. A pinned syncer does not count
|
||||||
|
; towards the configured `numgraphsyncpeers` since pinned syncers are not
|
||||||
|
; rotated. Configuring a pinned syncer does not ensure a persistent connection
|
||||||
|
; to the target peer, they will only be pinned if the connection remains active
|
||||||
|
; via some other mechanism, e.g. having an open channel.
|
||||||
|
;
|
||||||
|
; This feature is useful when trying to ensure that a node keeps its
|
||||||
|
; routing table tightly synchronized with a set of remote peers, e.g. multiple
|
||||||
|
; lightning nodes operated by the same service.
|
||||||
|
;
|
||||||
|
; Each value should be a hex-encoded pubkey of the pinned peer. Multiple pinned
|
||||||
|
; peers can be specified by setting multiple flags/fields in the config.
|
||||||
|
; gossip.pinned-syncers=pubkey1
|
||||||
|
; gossip.pinned-syncers=pubkey2
|
||||||
|
@ -820,6 +820,7 @@ func newServer(cfg *Config, listenAddrs []net.Addr,
|
|||||||
SubBatchDelay: time.Second * 5,
|
SubBatchDelay: time.Second * 5,
|
||||||
IgnoreHistoricalFilters: cfg.IgnoreHistoricalGossipFilters,
|
IgnoreHistoricalFilters: cfg.IgnoreHistoricalGossipFilters,
|
||||||
GossipUpdateThrottle: !cfg.ProtocolOptions.NoGossipThrottle(),
|
GossipUpdateThrottle: !cfg.ProtocolOptions.NoGossipThrottle(),
|
||||||
|
PinnedSyncers: cfg.Gossip.PinnedSyncers,
|
||||||
},
|
},
|
||||||
s.identityECDH.PubKey(),
|
s.identityECDH.PubKey(),
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user