@@ -1381,7 +1381,9 @@ pub enum NodeAnnouncementInfo {
1381
1381
1382
1382
impl NodeAnnouncementInfo {
1383
1383
/// 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 {
1385
1387
match self {
1386
1388
NodeAnnouncementInfo :: Relayed ( relayed) => & relayed. contents . features ,
1387
1389
NodeAnnouncementInfo :: Local ( local) => & local. features ,
@@ -1409,29 +1411,29 @@ impl NodeAnnouncementInfo {
1409
1411
/// Moniker assigned to the node.
1410
1412
///
1411
1413
/// 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 {
1413
1415
match self {
1414
1416
NodeAnnouncementInfo :: Relayed ( relayed) => & relayed. contents . alias ,
1415
1417
NodeAnnouncementInfo :: Local ( local) => & local. alias ,
1416
- }
1418
+ } . clone ( )
1417
1419
}
1418
1420
1419
1421
/// Internet-level addresses via which one can connect to the node
1420
- pub fn addresses ( & self ) -> & [ SocketAddress ] {
1422
+ pub fn addresses ( & self ) -> Vec < SocketAddress > {
1421
1423
match self {
1422
1424
NodeAnnouncementInfo :: Relayed ( relayed) => & relayed. contents . addresses ,
1423
1425
NodeAnnouncementInfo :: Local ( local) => & local. addresses ,
1424
- }
1426
+ } . to_vec ( )
1425
1427
}
1426
1428
1427
1429
/// An initial announcement of the node
1428
1430
///
1429
1431
/// 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 > {
1431
1433
match self {
1432
1434
NodeAnnouncementInfo :: Relayed ( announcement) => Some ( announcement) ,
1433
1435
NodeAnnouncementInfo :: Local ( _) => None ,
1434
- }
1436
+ } . cloned ( )
1435
1437
}
1436
1438
}
1437
1439
0 commit comments