@@ -1252,9 +1252,10 @@ pub enum NodeAnnouncementInfo {
1252
1252
}
1253
1253
1254
1254
impl NodeAnnouncementInfo {
1255
-
1256
1255
/// Protocol features the node announced support for
1257
- pub fn features ( & self ) -> & NodeFeatures {
1256
+ pub fn features ( & self ) -> NodeFeatures { self . features_ref ( ) . clone ( ) }
1257
+
1258
+ pub ( crate ) fn features_ref ( & self ) -> & NodeFeatures {
1258
1259
match self {
1259
1260
NodeAnnouncementInfo :: Relayed ( relayed) => {
1260
1261
& relayed. contents . features
@@ -1294,41 +1295,41 @@ impl NodeAnnouncementInfo {
1294
1295
/// Moniker assigned to the node.
1295
1296
///
1296
1297
/// May be invalid or malicious (eg control chars), should not be exposed to the user.
1297
- pub fn alias ( & self ) -> & NodeAlias {
1298
+ pub fn alias ( & self ) -> NodeAlias {
1298
1299
match self {
1299
1300
NodeAnnouncementInfo :: Relayed ( relayed) => {
1300
1301
& relayed. contents . alias
1301
1302
}
1302
1303
NodeAnnouncementInfo :: Local ( local) => {
1303
1304
& local. alias
1304
1305
}
1305
- }
1306
+ } . clone ( )
1306
1307
}
1307
1308
1308
1309
/// Internet-level addresses via which one can connect to the node
1309
- pub fn addresses ( & self ) -> & [ SocketAddress ] {
1310
+ pub fn addresses ( & self ) -> Vec < SocketAddress > {
1310
1311
match self {
1311
1312
NodeAnnouncementInfo :: Relayed ( relayed) => {
1312
1313
& relayed. contents . addresses
1313
1314
}
1314
1315
NodeAnnouncementInfo :: Local ( local) => {
1315
1316
& local. addresses
1316
1317
}
1317
- }
1318
+ } . to_vec ( )
1318
1319
}
1319
1320
1320
1321
/// An initial announcement of the node
1321
1322
///
1322
1323
/// Not stored if contains excess data to prevent DoS.
1323
- pub fn announcement_message ( & self ) -> Option < & NodeAnnouncement > {
1324
+ pub fn announcement_message ( & self ) -> Option < NodeAnnouncement > {
1324
1325
match self {
1325
1326
NodeAnnouncementInfo :: Relayed ( announcement) => {
1326
1327
Some ( announcement)
1327
1328
}
1328
1329
NodeAnnouncementInfo :: Local ( _) => {
1329
1330
None
1330
1331
}
1331
- }
1332
+ } . cloned ( )
1332
1333
}
1333
1334
}
1334
1335
0 commit comments