mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-06-27 01:02:56 +02:00
gossiper+server: define SelfNodeAnnouncement
This commit is contained in:
parent
e36d15582c
commit
24004fcb37
@ -147,6 +147,12 @@ type Config struct {
|
|||||||
// notification for when it reconnects.
|
// notification for when it reconnects.
|
||||||
NotifyWhenOffline func(peerPubKey [33]byte) <-chan struct{}
|
NotifyWhenOffline func(peerPubKey [33]byte) <-chan struct{}
|
||||||
|
|
||||||
|
// SelfNodeAnnouncement is a function that fetches our own current node
|
||||||
|
// announcement, for use when determining whether we should update our
|
||||||
|
// peers about our presence on the network. If the refresh is true, a
|
||||||
|
// new and updated announcement will be returned.
|
||||||
|
SelfNodeAnnouncement func(refresh bool) (lnwire.NodeAnnouncement, error)
|
||||||
|
|
||||||
// ProofMatureDelta the number of confirmations which is needed before
|
// ProofMatureDelta the number of confirmations which is needed before
|
||||||
// exchange the channel announcement proofs.
|
// exchange the channel announcement proofs.
|
||||||
ProofMatureDelta uint32
|
ProofMatureDelta uint32
|
||||||
|
@ -740,6 +740,11 @@ func createTestCtx(startHeight uint32) (*testCtx, func(), error) {
|
|||||||
c := make(chan struct{})
|
c := make(chan struct{})
|
||||||
return c
|
return c
|
||||||
},
|
},
|
||||||
|
SelfNodeAnnouncement: func(bool) (lnwire.NodeAnnouncement, error) {
|
||||||
|
return lnwire.NodeAnnouncement{
|
||||||
|
Timestamp: testTimestamp,
|
||||||
|
}, nil
|
||||||
|
},
|
||||||
Router: router,
|
Router: router,
|
||||||
TrickleDelay: trickleDelay,
|
TrickleDelay: trickleDelay,
|
||||||
RetransmitTicker: ticker.NewForce(retransmitDelay),
|
RetransmitTicker: ticker.NewForce(retransmitDelay),
|
||||||
@ -1492,6 +1497,7 @@ func TestSignatureAnnouncementRetryAtStartup(t *testing.T) {
|
|||||||
Broadcast: ctx.gossiper.cfg.Broadcast,
|
Broadcast: ctx.gossiper.cfg.Broadcast,
|
||||||
NotifyWhenOnline: ctx.gossiper.reliableSender.cfg.NotifyWhenOnline,
|
NotifyWhenOnline: ctx.gossiper.reliableSender.cfg.NotifyWhenOnline,
|
||||||
NotifyWhenOffline: ctx.gossiper.reliableSender.cfg.NotifyWhenOffline,
|
NotifyWhenOffline: ctx.gossiper.reliableSender.cfg.NotifyWhenOffline,
|
||||||
|
SelfNodeAnnouncement: ctx.gossiper.cfg.SelfNodeAnnouncement,
|
||||||
Router: ctx.gossiper.cfg.Router,
|
Router: ctx.gossiper.cfg.Router,
|
||||||
TrickleDelay: trickleDelay,
|
TrickleDelay: trickleDelay,
|
||||||
RetransmitTicker: ticker.NewForce(retransmitDelay),
|
RetransmitTicker: ticker.NewForce(retransmitDelay),
|
||||||
|
17
server.go
17
server.go
@ -710,13 +710,16 @@ func newServer(listenAddrs []net.Addr, chanDB *channeldb.DB,
|
|||||||
}
|
}
|
||||||
|
|
||||||
s.authGossiper = discovery.New(discovery.Config{
|
s.authGossiper = discovery.New(discovery.Config{
|
||||||
Router: s.chanRouter,
|
Router: s.chanRouter,
|
||||||
Notifier: s.cc.chainNotifier,
|
Notifier: s.cc.chainNotifier,
|
||||||
ChainHash: *activeNetParams.GenesisHash,
|
ChainHash: *activeNetParams.GenesisHash,
|
||||||
Broadcast: s.BroadcastMessage,
|
Broadcast: s.BroadcastMessage,
|
||||||
ChanSeries: chanSeries,
|
ChanSeries: chanSeries,
|
||||||
NotifyWhenOnline: s.NotifyWhenOnline,
|
NotifyWhenOnline: s.NotifyWhenOnline,
|
||||||
NotifyWhenOffline: s.NotifyWhenOffline,
|
NotifyWhenOffline: s.NotifyWhenOffline,
|
||||||
|
SelfNodeAnnouncement: func(refresh bool) (lnwire.NodeAnnouncement, error) {
|
||||||
|
return s.genNodeAnnouncement(refresh)
|
||||||
|
},
|
||||||
ProofMatureDelta: 0,
|
ProofMatureDelta: 0,
|
||||||
TrickleDelay: time.Millisecond * time.Duration(cfg.TrickleDelay),
|
TrickleDelay: time.Millisecond * time.Duration(cfg.TrickleDelay),
|
||||||
RetransmitTicker: ticker.New(time.Minute * 30),
|
RetransmitTicker: ticker.New(time.Minute * 30),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user