File tree 4 files changed +19
-5
lines changed
lightning-rapid-gossip-sync/src
4 files changed +19
-5
lines changed Original file line number Diff line number Diff line change @@ -178,7 +178,7 @@ where
178
178
synthetic_node_announcement. features = info. features ( ) . clone ( ) ;
179
179
synthetic_node_announcement. rgb = info. rgb ( ) . clone ( ) ;
180
180
synthetic_node_announcement. alias = info. alias ( ) . clone ( ) ;
181
- synthetic_node_announcement. addresses = info. addresses ( ) . clone ( ) ;
181
+ synthetic_node_announcement. addresses = info. addresses ( ) . to_vec ( ) ;
182
182
} ) ;
183
183
184
184
if has_address_details {
Original file line number Diff line number Diff line change @@ -595,7 +595,7 @@ where
595
595
596
596
match node_details {
597
597
Some ( ( features, addresses) ) if features. supports_onion_messages ( ) && addresses. len ( ) > 0 => {
598
- let first_node_addresses = Some ( addresses. clone ( ) ) ;
598
+ let first_node_addresses = Some ( addresses. to_vec ( ) ) ;
599
599
Ok ( OnionMessagePath {
600
600
intermediate_nodes : vec ! [ ] , destination, first_node_addresses
601
601
} )
Original file line number Diff line number Diff line change @@ -1308,7 +1308,7 @@ impl NodeAnnouncementInfo {
1308
1308
}
1309
1309
1310
1310
/// Internet-level addresses via which one can connect to the node
1311
- pub fn addresses ( & self ) -> & Vec < SocketAddress > {
1311
+ pub fn addresses ( & self ) -> & [ SocketAddress ] {
1312
1312
match self {
1313
1313
NodeAnnouncementInfo :: Relayed ( relayed) => {
1314
1314
& relayed. contents . addresses
Original file line number Diff line number Diff line change @@ -656,10 +656,24 @@ impl Readable for WithoutLength<UntrustedString> {
656
656
}
657
657
}
658
658
659
- impl < ' a , T : Writeable > Writeable for WithoutLength < & ' a Vec < T > > {
659
+ trait AsWriteableSlice {
660
+ type Inner : Writeable ;
661
+ fn as_slice ( & self ) -> & [ Self :: Inner ] ;
662
+ }
663
+
664
+ impl < T : Writeable > AsWriteableSlice for & Vec < T > {
665
+ type Inner = T ;
666
+ fn as_slice ( & self ) -> & [ T ] { & self }
667
+ }
668
+ impl < T : Writeable > AsWriteableSlice for & [ T ] {
669
+ type Inner = T ;
670
+ fn as_slice ( & self ) -> & [ T ] { & self }
671
+ }
672
+
673
+ impl < S : AsWriteableSlice > Writeable for WithoutLength < S > {
660
674
#[ inline]
661
675
fn write < W : Writer > ( & self , writer : & mut W ) -> Result < ( ) , io:: Error > {
662
- for ref v in self . 0 . iter ( ) {
676
+ for ref v in self . 0 . as_slice ( ) {
663
677
v. write ( writer) ?;
664
678
}
665
679
Ok ( ( ) )
You can’t perform that action at this time.
0 commit comments