discovery+server: make RebroadcastInterval part of config
This commit is contained in:
2 files changed
+12
-6
No files matched your search
+11
-6
@@ -160,6 +160,13 @@ type Config struct {
|
|||||||
// should check if we need re-broadcast any of our personal channels.
|
// should check if we need re-broadcast any of our personal channels.
|
||||||
RetransmitDelay time.Duration
|
RetransmitDelay time.Duration
|
||||||
|
|
||||||
|
// RebroadcastInterval is the maximum time we wait between sending out
|
||||||
|
// channel updates for our active channels and our own node
|
||||||
|
// announcement. We do this to ensure our active presence on the
|
||||||
|
// network is known, and we are not being considered a zombie node or
|
||||||
|
// having zombie channels.
|
||||||
|
RebroadcastInterval time.Duration
|
||||||
|
|
||||||
// WaitingProofStore is a persistent storage of partial channel proof
|
// WaitingProofStore is a persistent storage of partial channel proof
|
||||||
// announcement messages. We use it to buffer half of the material
|
// announcement messages. We use it to buffer half of the material
|
||||||
// needed to reconstruct a full authenticated channel announcement.
|
// needed to reconstruct a full authenticated channel announcement.
|
||||||
@@ -1193,14 +1200,12 @@ func (d *AuthenticatedGossiper) retransmitStaleChannels() error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
const broadcastInterval = time.Hour * 24
|
|
||||||
|
|
||||||
timeElapsed := time.Since(edge.LastUpdate)
|
timeElapsed := time.Since(edge.LastUpdate)
|
||||||
|
|
||||||
// If it's been a full day since we've re-broadcasted the
|
// If it's been longer than RebroadcastInterval since we've
|
||||||
// channel, add the channel to the set of edges we need to
|
// re-broadcasted the channel, add the channel to the set of
|
||||||
// update.
|
// edges we need to update.
|
||||||
if timeElapsed >= broadcastInterval {
|
if timeElapsed >= d.cfg.RebroadcastInterval {
|
||||||
edgesToUpdate = append(edgesToUpdate, updateTuple{
|
edgesToUpdate = append(edgesToUpdate, updateTuple{
|
||||||
info: info,
|
info: info,
|
||||||
edge: edge,
|
edge: edge,
|
||||||
|
|||||||
@@ -720,6 +720,7 @@ func newServer(listenAddrs []net.Addr, chanDB *channeldb.DB,
|
|||||||
ProofMatureDelta: 0,
|
ProofMatureDelta: 0,
|
||||||
TrickleDelay: time.Millisecond * time.Duration(cfg.TrickleDelay),
|
TrickleDelay: time.Millisecond * time.Duration(cfg.TrickleDelay),
|
||||||
RetransmitDelay: time.Minute * 30,
|
RetransmitDelay: time.Minute * 30,
|
||||||
|
RebroadcastInterval: time.Hour * 24,
|
||||||
WaitingProofStore: waitingProofStore,
|
WaitingProofStore: waitingProofStore,
|
||||||
MessageStore: gossipMessageStore,
|
MessageStore: gossipMessageStore,
|
||||||
AnnSigner: s.nodeSigner,
|
AnnSigner: s.nodeSigner,
|
||||||
|
|||||||
Reference in new issue
Block a user