mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-08-29 07:00:55 +02:00
multi/refactor: separate methods for get and set node announcement
In preparation for a more complex function signature for set node announcement, separate get and set so that readonly callers don't need to handle the extra arguments.
This commit is contained in:
@@ -168,15 +168,18 @@ func (h *HostAnnouncer) hostWatcher() {
|
||||
// NodeAnnUpdater describes a function that's able to update our current node
|
||||
// announcement on disk. It returns the updated node announcement given a set
|
||||
// of updates to be applied to the current node announcement.
|
||||
type NodeAnnUpdater func(refresh bool, modifier ...NodeAnnModifier,
|
||||
type NodeAnnUpdater func(modifier ...NodeAnnModifier,
|
||||
) (lnwire.NodeAnnouncement, error)
|
||||
|
||||
// IPAnnouncer is a factory function that generates a new function that uses
|
||||
// the passed annUpdater function to to announce new IP changes for a given
|
||||
// host.
|
||||
func IPAnnouncer(annUpdater NodeAnnUpdater) func([]net.Addr, map[string]struct{}) error {
|
||||
func IPAnnouncer(annUpdater NodeAnnUpdater) func([]net.Addr,
|
||||
map[string]struct{}) error {
|
||||
|
||||
return func(newAddrs []net.Addr, oldAddrs map[string]struct{}) error {
|
||||
_, err := annUpdater(true, func(currentNodeAnn *lnwire.NodeAnnouncement) {
|
||||
_, err := annUpdater(func(
|
||||
currentNodeAnn *lnwire.NodeAnnouncement) {
|
||||
// To ensure we don't duplicate any addresses, we'll
|
||||
// filter out the same of addresses we should no longer
|
||||
// advertise.
|
||||
|
Reference in New Issue
Block a user