From d63599427279a449f866363419a6a660eb898dd3 Mon Sep 17 00:00:00 2001 From: Wilmer Paulino Date: Mon, 23 Apr 2018 12:44:14 -0400 Subject: [PATCH] lnwire: add functional option that updates a node announcement's addresses --- lnwire/node_announcement.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lnwire/node_announcement.go b/lnwire/node_announcement.go index 753fca588..3a0b7ff9b 100644 --- a/lnwire/node_announcement.go +++ b/lnwire/node_announcement.go @@ -85,6 +85,14 @@ type NodeAnnouncement struct { Addresses []net.Addr } +// UpdateNodeAnnAddrs is a functional option that allows updating the addresses +// of the given node announcement. +func UpdateNodeAnnAddrs(addrs []net.Addr) func(*NodeAnnouncement) { + return func(nodeAnn *NodeAnnouncement) { + nodeAnn.Addresses = addrs + } +} + // A compile time check to ensure NodeAnnouncement implements the // lnwire.Message interface. var _ Message = (*NodeAnnouncement)(nil)