File tree Expand file tree Collapse file tree 4 files changed +19
-5
lines changed
lightning-rapid-gossip-sync/src Expand file tree Collapse file tree 4 files changed +19
-5
lines changed Original file line number Diff line number Diff line change @@ -178,7 +178,7 @@ where
178178 synthetic_node_announcement. features = info. features ( ) . clone ( ) ;
179179 synthetic_node_announcement. rgb = info. rgb ( ) . clone ( ) ;
180180 synthetic_node_announcement. alias = info. alias ( ) . clone ( ) ;
181- synthetic_node_announcement. addresses = info. addresses ( ) . clone ( ) ;
181+ synthetic_node_announcement. addresses = info. addresses ( ) . to_vec ( ) ;
182182 } ) ;
183183
184184 if has_address_details {
Original file line number Diff line number Diff line change @@ -595,7 +595,7 @@ where
595595
596596 match node_details {
597597 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 ( ) ) ;
599599 Ok ( OnionMessagePath {
600600 intermediate_nodes : vec ! [ ] , destination, first_node_addresses
601601 } )
Original file line number Diff line number Diff line change @@ -1308,7 +1308,7 @@ impl NodeAnnouncementInfo {
13081308 }
13091309
13101310 /// Internet-level addresses via which one can connect to the node
1311- pub fn addresses ( & self ) -> & Vec < SocketAddress > {
1311+ pub fn addresses ( & self ) -> & [ SocketAddress ] {
13121312 match self {
13131313 NodeAnnouncementInfo :: Relayed ( relayed) => {
13141314 & relayed. contents . addresses
Original file line number Diff line number Diff line change @@ -656,10 +656,24 @@ impl Readable for WithoutLength<UntrustedString> {
656656 }
657657}
658658
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 > {
660674 #[ inline]
661675 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 ( ) {
663677 v. write ( writer) ?;
664678 }
665679 Ok ( ( ) )
You can’t perform that action at this time.
0 commit comments