@@ -1737,6 +1737,7 @@ mod fuzzy_internal_msgs {
1737
1737
encrypted_tlvs : Vec < u8 > ,
1738
1738
intro_node_blinding_point : Option < PublicKey > , // Set if the introduction node of the blinded path is the final node
1739
1739
keysend_preimage : Option < PaymentPreimage > ,
1740
+ custom_tlvs : Vec < ( u64 , Vec < u8 > ) > ,
1740
1741
}
1741
1742
}
1742
1743
@@ -2581,16 +2582,21 @@ impl Writeable for OutboundOnionPayload {
2581
2582
} ,
2582
2583
Self :: BlindedReceive {
2583
2584
sender_intended_htlc_amt_msat, total_msat, cltv_expiry_height, encrypted_tlvs,
2584
- intro_node_blinding_point, keysend_preimage,
2585
+ intro_node_blinding_point, keysend_preimage, ref custom_tlvs ,
2585
2586
} => {
2587
+ // We need to update [`ln::outbound_payment::RecipientOnionFields::with_custom_tlvs`]
2588
+ // to reject any reserved types in the experimental range if new ones are ever
2589
+ // standardized.
2590
+ let keysend_tlv = keysend_preimage. map ( |preimage| ( 5482373484 , preimage. encode ( ) ) ) ;
2591
+ let mut custom_tlvs: Vec < & ( u64 , Vec < u8 > ) > = custom_tlvs. iter ( ) . chain ( keysend_tlv. iter ( ) ) . collect ( ) ;
2592
+ custom_tlvs. sort_unstable_by_key ( |( typ, _) | * typ) ;
2586
2593
_encode_varint_length_prefixed_tlv ! ( w, {
2587
2594
( 2 , HighZeroBytesDroppedBigSize ( * sender_intended_htlc_amt_msat) , required) ,
2588
2595
( 4 , HighZeroBytesDroppedBigSize ( * cltv_expiry_height) , required) ,
2589
2596
( 10 , * encrypted_tlvs, required_vec) ,
2590
2597
( 12 , intro_node_blinding_point, option) ,
2591
- ( 18 , HighZeroBytesDroppedBigSize ( * total_msat) , required) ,
2592
- ( 5482373484 , keysend_preimage, option)
2593
- } ) ;
2598
+ ( 18 , HighZeroBytesDroppedBigSize ( * total_msat) , required)
2599
+ } , custom_tlvs. iter( ) ) ;
2594
2600
} ,
2595
2601
}
2596
2602
Ok ( ( ) )
0 commit comments