-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
discovery+lnd: make param ProofMatureDelta
configurable
#9405
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,24 @@ | ||
package lncfg | ||
|
||
import ( | ||
"fmt" | ||
"time" | ||
|
||
"github.com/lightningnetwork/lnd/discovery" | ||
"github.com/lightningnetwork/lnd/routing/route" | ||
) | ||
|
||
// minAnnouncementConf defines the minimal num of confs needed for the config | ||
// AnnouncementConf. We choose 3 here as it's unlikely a reorg depth of 3 would | ||
// happen. | ||
// | ||
// NOTE: The specs recommends setting this value to 6, which is the default | ||
// value used for AnnouncementConf. However the receiver should be able to | ||
// decide which channels to be included in its local graph, more details can be | ||
// found: | ||
// - https://github.com/lightning/bolts/pull/1215#issuecomment-2557337202 | ||
const minAnnouncementConf = 3 | ||
|
||
//nolint:ll | ||
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 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."` | ||
|
@@ -18,6 +30,8 @@ type Gossip struct { | |
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."` | ||
|
||
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."` | ||
|
||
AnnouncementConf uint32 `long:"announcement-conf" description:"The number of confirmations required before processing channel announcements."` | ||
} | ||
|
||
// Parse the pubkeys for the pinned syncers. | ||
|
@@ -35,3 +49,17 @@ func (g *Gossip) Parse() error { | |
|
||
return nil | ||
} | ||
|
||
// Validate checks the Gossip configuration to ensure that the input values are | ||
// sane. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you add a rationale why not less than 3 ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. updated |
||
func (g *Gossip) Validate() error { | ||
if g.AnnouncementConf < minAnnouncementConf { | ||
return fmt.Errorf("announcement-conf=%v must be no less than "+ | ||
"%v", g.AnnouncementConf, minAnnouncementConf) | ||
} | ||
|
||
return nil | ||
} | ||
|
||
// Compile-time constraint to ensure Gossip implements the Validator interface. | ||
var _ Validator = (*Gossip)(nil) |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1118,7 +1118,7 @@ func newServer(cfg *Config, listenAddrs []net.Addr, | |
|
||
return s.genNodeAnnouncement(nil) | ||
}, | ||
ProofMatureDelta: 0, | ||
ProofMatureDelta: cfg.Gossip.AnnouncementConf, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm I am not sure if we should block our own local anounccemnts, this should be regared as an error because why are we sending them in the first place to the gossiper ? So for the remote it makes sense but for the local I think we should just log something but not block it, wdyt ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think we ever block announcements - we cache them when they haven't reached 6 confs. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. talking about this case here:
I wonder why we do check for the local announcement here and return an error, I would expect that our own software produces announments which we want to skip this check. Basically it seems weird to catch the own channel_announcments here. We kinda don't trust our own sourced announcements ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
yeah I think this makes sense, as we skip the maturity check elsewhere when it's from local. Also correct that the funding manager should never attempt to send this msg unless it has 6 confs. The only possible case when we hit an error is when the two subsystems are not in sync with block heights, which means they should also be block consumers. The current behavior will cache the early msg and reprocess it when it reaches 6 conf, tho I think it's better if we just skip checking the maturity when it's from the local, so maybe a follow up PR? |
||
TrickleDelay: time.Millisecond * time.Duration(cfg.TrickleDelay), | ||
RetransmitTicker: ticker.New(time.Minute * 30), | ||
RebroadcastInterval: time.Hour * 24, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Separate release notes in own commit
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated