@@ -56,6 +56,11 @@ async fn test_cli_get_node_info() {
5656 let output = run_cli ( & server, & [ "get-node-info" ] ) ;
5757 assert ! ( output. get( "node_id" ) . is_some( ) ) ;
5858 assert_eq ! ( output[ "node_id" ] , server. node_id( ) ) ;
59+
60+ // Ensure clients can inspect advertised node capabilities from get-node-info.
61+ let keysend = & output[ "features" ] [ "55" ] ;
62+ assert_eq ! ( keysend[ "name" ] , "Keysend" ) ;
63+ assert_eq ! ( keysend[ "is_required" ] , false ) ;
5964}
6065
6166#[ tokio:: test]
@@ -207,33 +212,27 @@ async fn test_cli_decode_invoice() {
207212 // Verify features — LDK BOLT11 invoices always set VariableLengthOnion, PaymentSecret,
208213 // and BasicMPP.
209214 let features = decoded[ "features" ] . as_object ( ) . unwrap ( ) ;
210- assert ! ( !features. is_empty( ) , "Expected at least one feature" ) ;
211-
212- let feature_names: Vec < & str > = features. values ( ) . filter_map ( |f| f[ "name" ] . as_str ( ) ) . collect ( ) ;
213- assert ! (
214- feature_names. contains( & "VariableLengthOnion" ) ,
215- "Expected VariableLengthOnion in features: {:?}" ,
216- feature_names
217- ) ;
218- assert ! (
219- feature_names. contains( & "PaymentSecret" ) ,
220- "Expected PaymentSecret in features: {:?}" ,
221- feature_names
222- ) ;
223- assert ! (
224- feature_names. contains( & "BasicMPP" ) ,
225- "Expected BasicMPP in features: {:?}" ,
226- feature_names
227- ) ;
228215
229- // Every entry should have the expected structure
216+ // Every entry should be keyed by the signaled bit and expose the decoded name
217+ // plus whether that bit is required.
230218 for ( bit, feature) in features {
231- assert ! ( bit. parse:: <u32 >( ) . is_ok( ) , "Feature key should be a bit number: {}" , bit ) ;
219+ assert ! ( bit. parse:: <u32 >( ) . is_ok( ) , "Feature key is not a bit number: {bit}" ) ;
232220 assert ! ( feature. get( "name" ) . is_some( ) , "Feature missing name field" ) ;
233221 assert ! ( feature. get( "is_required" ) . is_some( ) , "Feature missing is_required field" ) ;
234- assert ! ( feature. get( "is_known" ) . is_some( ) , "Feature missing is_known field" ) ;
235222 }
236223
224+ let variable_length_onion = & features[ "8" ] ;
225+ assert_eq ! ( variable_length_onion[ "name" ] , "VariableLengthOnion" ) ;
226+ assert_eq ! ( variable_length_onion[ "is_required" ] , true ) ;
227+
228+ let payment_secret = & features[ "14" ] ;
229+ assert_eq ! ( payment_secret[ "name" ] , "PaymentSecret" ) ;
230+ assert_eq ! ( payment_secret[ "is_required" ] , true ) ;
231+
232+ let basic_mpp = & features[ "17" ] ;
233+ assert_eq ! ( basic_mpp[ "name" ] , "BasicMPP" ) ;
234+ assert_eq ! ( basic_mpp[ "is_required" ] , false ) ;
235+
237236 // Also test a variable-amount invoice
238237 let output_var = run_cli ( & server, & [ "bolt11-receive" , "-d" , "no amount" ] ) ;
239238 let decoded_var =
@@ -927,17 +926,13 @@ async fn test_cli_spontaneous_send_with_custom_tlvs() {
927926 assert ! ( !output[ "payment_id" ] . as_str( ) . unwrap( ) . is_empty( ) ) ;
928927
929928 // The receiver must observe both TLVs in PaymentReceived.
930- let event_b =
931- wait_for_event ( & mut events_b, |e| matches ! ( e, Event :: PaymentReceived ( _) ) ) . await ;
929+ let event_b = wait_for_event ( & mut events_b, |e| matches ! ( e, Event :: PaymentReceived ( _) ) ) . await ;
932930 let Some ( Event :: PaymentReceived ( pr) ) = event_b. event else {
933931 panic ! ( "expected PaymentReceived" ) ;
934932 } ;
935933 assert_eq ! ( pr. custom_records. len( ) , 2 ) ;
936- let by_type: HashMap < u64 , Vec < u8 > > = pr
937- . custom_records
938- . into_iter ( )
939- . map ( |r| ( r. type_num , r. value . to_vec ( ) ) )
940- . collect ( ) ;
934+ let by_type: HashMap < u64 , Vec < u8 > > =
935+ pr. custom_records . into_iter ( ) . map ( |r| ( r. type_num , r. value . to_vec ( ) ) ) . collect ( ) ;
941936 assert_eq ! ( by_type. get( & 65537 ) . cloned( ) , Some ( vec![ 0xde , 0xad , 0xbe , 0xef ] ) ) ;
942937 assert_eq ! ( by_type. get( & 65539 ) . cloned( ) , Some ( vec![ 0xca , 0xfe ] ) ) ;
943938}
@@ -1177,8 +1172,7 @@ async fn test_forwarded_payment_event() {
11771172 builder_c. set_liquidity_source_lsps2 ( b_node_id, b_addr, None ) ;
11781173
11791174 let mnemonic_c = ldk_node:: entropy:: generate_entropy_mnemonic ( None ) ;
1180- let node_entropy_c =
1181- ldk_node:: entropy:: NodeEntropy :: from_bip39_mnemonic ( mnemonic_c, None ) ;
1175+ let node_entropy_c = ldk_node:: entropy:: NodeEntropy :: from_bip39_mnemonic ( mnemonic_c, None ) ;
11821176 let node_c = builder_c. build ( node_entropy_c) . unwrap ( ) ;
11831177
11841178 node_c. start ( ) . unwrap ( ) ;
0 commit comments