@@ -1388,7 +1388,9 @@ pub enum NodeAnnouncementInfo {
13881388
13891389impl NodeAnnouncementInfo {
13901390 /// Protocol features the node announced support for
1391- pub fn features ( & self ) -> & NodeFeatures {
1391+ pub fn features ( & self ) -> NodeFeatures { self . features_ref ( ) . clone ( ) }
1392+
1393+ pub ( crate ) fn features_ref ( & self ) -> & NodeFeatures {
13921394 match self {
13931395 NodeAnnouncementInfo :: Relayed ( relayed) => & relayed. contents . features ,
13941396 NodeAnnouncementInfo :: Local ( local) => & local. features ,
@@ -1416,29 +1418,29 @@ impl NodeAnnouncementInfo {
14161418 /// Moniker assigned to the node.
14171419 ///
14181420 /// May be invalid or malicious (eg control chars), should not be exposed to the user.
1419- pub fn alias ( & self ) -> & NodeAlias {
1421+ pub fn alias ( & self ) -> NodeAlias {
14201422 match self {
14211423 NodeAnnouncementInfo :: Relayed ( relayed) => & relayed. contents . alias ,
14221424 NodeAnnouncementInfo :: Local ( local) => & local. alias ,
1423- }
1425+ } . clone ( )
14241426 }
14251427
14261428 /// Internet-level addresses via which one can connect to the node
1427- pub fn addresses ( & self ) -> & [ SocketAddress ] {
1429+ pub fn addresses ( & self ) -> Vec < SocketAddress > {
14281430 match self {
14291431 NodeAnnouncementInfo :: Relayed ( relayed) => & relayed. contents . addresses ,
14301432 NodeAnnouncementInfo :: Local ( local) => & local. addresses ,
1431- }
1433+ } . to_vec ( )
14321434 }
14331435
14341436 /// An initial announcement of the node
14351437 ///
14361438 /// Not stored if contains excess data to prevent DoS.
1437- pub fn announcement_message ( & self ) -> Option < & NodeAnnouncement > {
1439+ pub fn announcement_message ( & self ) -> Option < NodeAnnouncement > {
14381440 match self {
14391441 NodeAnnouncementInfo :: Relayed ( announcement) => Some ( announcement) ,
14401442 NodeAnnouncementInfo :: Local ( _) => None ,
1441- }
1443+ } . cloned ( )
14421444 }
14431445}
14441446
0 commit comments