@@ -1111,11 +1111,47 @@ async fn test_cli_graph_with_channel() {
11111111 assert ! ( node_ids. contains( & server_a. node_id( ) ) , "Expected server_a in graph nodes" ) ;
11121112 assert ! ( node_ids. contains( & server_b. node_id( ) ) , "Expected server_b in graph nodes" ) ;
11131113
1114- // Test GraphGetNode: should return node info with at least one channel.
1115- let output = run_cli ( & server_a, & [ "graph-get-node" , server_b. node_id ( ) ] ) ;
1114+ // Test GraphGetNode: should return node info with at least one channel and
1115+ // node announcement features once the node announcement reaches the graph.
1116+ let output = {
1117+ let start = std:: time:: Instant :: now ( ) ;
1118+ loop {
1119+ let output = run_cli ( & server_a, & [ "graph-get-node" , server_b. node_id ( ) ] ) ;
1120+ let node = & output[ "node" ] ;
1121+ let has_channel =
1122+ node[ "channels" ] . as_array ( ) . is_some_and ( |channels| !channels. is_empty ( ) ) ;
1123+ let has_announcement_features = node[ "announcement_info" ] [ "features" ]
1124+ . as_object ( )
1125+ . is_some_and ( |features| !features. is_empty ( ) ) ;
1126+
1127+ if has_channel && has_announcement_features {
1128+ break output;
1129+ }
1130+ if start. elapsed ( ) > Duration :: from_secs ( 30 ) {
1131+ panic ! ( "Timed out waiting for node announcement features in network graph" ) ;
1132+ }
1133+ tokio:: time:: sleep ( Duration :: from_secs ( 1 ) ) . await ;
1134+ }
1135+ } ;
11161136 let node = & output[ "node" ] ;
11171137 let channels = node[ "channels" ] . as_array ( ) . unwrap ( ) ;
11181138 assert ! ( !channels. is_empty( ) , "Expected node to have at least one channel" ) ;
1139+
1140+ let announcement_info = & node[ "announcement_info" ] ;
1141+ let features = announcement_info[ "features" ] . as_object ( ) . unwrap ( ) ;
1142+ assert ! ( !features. is_empty( ) , "Expected node announcement features" ) ;
1143+
1144+ // Every entry should be keyed by the signaled bit and expose the decoded name
1145+ // plus whether that bit is required.
1146+ for ( bit, feature) in features {
1147+ assert ! ( bit. parse:: <u32 >( ) . is_ok( ) , "Feature key is not a bit number: {bit}" ) ;
1148+ assert ! ( feature. get( "name" ) . is_some( ) , "Feature missing name field" ) ;
1149+ assert ! ( feature. get( "is_required" ) . is_some( ) , "Feature missing is_required field" ) ;
1150+ }
1151+
1152+ let keysend = & features[ "55" ] ;
1153+ assert_eq ! ( keysend[ "name" ] , "Keysend" ) ;
1154+ assert_eq ! ( keysend[ "is_required" ] , false ) ;
11191155}
11201156
11211157#[ tokio:: test]
0 commit comments