server: include optional updates when generating a new node announcement

This commit is contained in:
Wilmer Paulino 2018-04-23 12:43:50 -04:00
parent d635994272
commit 2ad9823945
No known key found for this signature in database
GPG Key ID: 6DF57B9F9514972F

View File

@ -987,8 +987,8 @@ func (s *server) initTorController() error {
// genNodeAnnouncement generates and returns the current fully signed node // genNodeAnnouncement generates and returns the current fully signed node
// announcement. If refresh is true, then the time stamp of the announcement // announcement. If refresh is true, then the time stamp of the announcement
// will be updated in order to ensure it propagates through the network. // will be updated in order to ensure it propagates through the network.
func (s *server) genNodeAnnouncement( func (s *server) genNodeAnnouncement(refresh bool,
refresh bool) (lnwire.NodeAnnouncement, error) { updates ...func(*lnwire.NodeAnnouncement)) (lnwire.NodeAnnouncement, error) {
s.mu.Lock() s.mu.Lock()
defer s.mu.Unlock() defer s.mu.Unlock()
@ -997,7 +997,9 @@ func (s *server) genNodeAnnouncement(
return *s.currentNodeAnn, nil return *s.currentNodeAnn, nil
} }
var err error for _, update := range updates {
update(s.currentNodeAnn)
}
newStamp := uint32(time.Now().Unix()) newStamp := uint32(time.Now().Unix())
if newStamp <= s.currentNodeAnn.Timestamp { if newStamp <= s.currentNodeAnn.Timestamp {