@@ -1381,7 +1381,9 @@ pub enum NodeAnnouncementInfo {
13811381
13821382impl NodeAnnouncementInfo {
13831383 /// Protocol features the node announced support for
1384- pub fn features ( & self ) -> & NodeFeatures {
1384+ pub fn features ( & self ) -> NodeFeatures { self . features_ref ( ) . clone ( ) }
1385+
1386+ pub ( crate ) fn features_ref ( & self ) -> & NodeFeatures {
13851387 match self {
13861388 NodeAnnouncementInfo :: Relayed ( relayed) => & relayed. contents . features ,
13871389 NodeAnnouncementInfo :: Local ( local) => & local. features ,
@@ -1409,29 +1411,29 @@ impl NodeAnnouncementInfo {
14091411 /// Moniker assigned to the node.
14101412 ///
14111413 /// May be invalid or malicious (eg control chars), should not be exposed to the user.
1412- pub fn alias ( & self ) -> & NodeAlias {
1414+ pub fn alias ( & self ) -> NodeAlias {
14131415 match self {
14141416 NodeAnnouncementInfo :: Relayed ( relayed) => & relayed. contents . alias ,
14151417 NodeAnnouncementInfo :: Local ( local) => & local. alias ,
1416- }
1418+ } . clone ( )
14171419 }
14181420
14191421 /// Internet-level addresses via which one can connect to the node
1420- pub fn addresses ( & self ) -> & [ SocketAddress ] {
1422+ pub fn addresses ( & self ) -> Vec < SocketAddress > {
14211423 match self {
14221424 NodeAnnouncementInfo :: Relayed ( relayed) => & relayed. contents . addresses ,
14231425 NodeAnnouncementInfo :: Local ( local) => & local. addresses ,
1424- }
1426+ } . to_vec ( )
14251427 }
14261428
14271429 /// An initial announcement of the node
14281430 ///
14291431 /// Not stored if contains excess data to prevent DoS.
1430- pub fn announcement_message ( & self ) -> Option < & NodeAnnouncement > {
1432+ pub fn announcement_message ( & self ) -> Option < NodeAnnouncement > {
14311433 match self {
14321434 NodeAnnouncementInfo :: Relayed ( announcement) => Some ( announcement) ,
14331435 NodeAnnouncementInfo :: Local ( _) => None ,
1434- }
1436+ } . cloned ( )
14351437 }
14361438}
14371439
0 commit comments