@@ -267,8 +267,26 @@ where
267
267
latest_seen_timestamp
268
268
) ;
269
269
270
+ let mut funding_sats: Option < u64 > = None ;
271
+
272
+ if version >= 2 && has_additional_data {
273
+ // forwards compatibility
274
+ let additional_data: Vec < u8 > = Readable :: read ( read_cursor) ?;
275
+ let mut cursor = & additional_data[ ..] ;
276
+ let funding_sats_read: BigSize = Readable :: read ( & mut cursor) ?;
277
+ funding_sats = Some ( funding_sats_read. 0 ) ;
278
+ if !cursor. is_empty ( ) {
279
+ log_gossip ! (
280
+ self . logger,
281
+ "Ignoring {} bytes of additional data in channel announcement" ,
282
+ cursor. len( )
283
+ ) ;
284
+ }
285
+ }
286
+
270
287
let announcement_result = network_graph. add_channel_from_partial_announcement (
271
288
short_channel_id,
289
+ funding_sats,
272
290
backdated_timestamp as u64 ,
273
291
features,
274
292
node_id_1,
@@ -286,16 +304,6 @@ where
286
304
return Err ( lightning_error. into ( ) ) ;
287
305
}
288
306
}
289
-
290
- if version >= 2 && has_additional_data {
291
- // forwards compatibility
292
- let additional_data: Vec < u8 > = Readable :: read ( read_cursor) ?;
293
- log_gossip ! (
294
- self . logger,
295
- "Ignoring {} bytes of additional data in channel announcement" ,
296
- additional_data. len( )
297
- ) ;
298
- }
299
307
}
300
308
301
309
for modification in node_modifications {
@@ -664,7 +672,7 @@ mod tests {
664
672
0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ,
665
673
0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ,
666
674
0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ,
667
- 0 , 0 , 0 , 1 , 0 , 0 , 1 , 0 , 255 , 128 , 0 , 0 , 0 , 0 , 0 , 0 , 1 , 0 , 147 , 23 , 23 , 23 , 23 , 23 , 23 ,
675
+ 0 , 0 , 0 , 1 , 0 , 0 , 1 , 0 , 255 , 128 , 0 , 0 , 0 , 0 , 0 , 0 , 1 , 0 , 147 , 42 , 23 , 23 , 23 , 23 , 23 ,
668
676
23 , 23 , 23 , 23 , 23 , 23 , 23 , 23 , 23 , 23 , 23 , 23 , 23 , 23 , 23 , 23 , 23 , 23 , 23 , 23 , 23 , 23 ,
669
677
23 , 23 , 23 , 23 , 23 , 23 , 23 , 23 , 23 , 23 , 23 , 23 , 23 , 23 , 23 , 23 , 23 , 23 , 23 , 23 , 23 , 23 ,
670
678
23 , 23 , 23 , 23 , 23 , 23 , 23 , 23 , 23 , 23 , 23 , 23 , 23 , 23 , 23 , 23 , 23 , 23 , 23 , 23 , 23 , 23 ,
@@ -685,9 +693,11 @@ mod tests {
685
693
"Ignoring 255 bytes of additional data in node announcement" ,
686
694
3 ,
687
695
) ;
696
+ // Note that our extra data is 147 bytes long, but the first byte (42) is read as the
697
+ // channel's funding amount (as a BigSize).
688
698
logger. assert_log_contains (
689
699
"lightning_rapid_gossip_sync::processing" ,
690
- "Ignoring 147 bytes of additional data in channel announcement" ,
700
+ "Ignoring 146 bytes of additional data in channel announcement" ,
691
701
1 ,
692
702
) ;
693
703
logger. assert_log_contains (
0 commit comments