@@ -31,7 +31,7 @@ use bitcoin::{secp256k1, Witness};
3131use bitcoin:: blockdata:: script:: ScriptBuf ;
3232use bitcoin:: hash_types:: Txid ;
3333
34- use crate :: blinded_path:: payment:: ReceiveTlvs ;
34+ use crate :: blinded_path:: payment:: { BlindedPaymentTlvs , ForwardTlvs , ReceiveTlvs } ;
3535use crate :: ln:: { ChannelId , PaymentPreimage , PaymentHash , PaymentSecret } ;
3636use crate :: ln:: features:: { ChannelFeatures , ChannelTypeFeatures , InitFeatures , NodeFeatures } ;
3737use crate :: ln:: onion_utils;
@@ -1666,9 +1666,10 @@ pub trait OnionMessageHandler {
16661666
16671667mod fuzzy_internal_msgs {
16681668 use bitcoin:: secp256k1:: PublicKey ;
1669- use crate :: blinded_path:: payment:: PaymentConstraints ;
1669+ use crate :: blinded_path:: payment:: { PaymentConstraints , PaymentRelay } ;
16701670 use crate :: prelude:: * ;
16711671 use crate :: ln:: { PaymentPreimage , PaymentSecret } ;
1672+ use crate :: ln:: features:: BlindedHopFeatures ;
16721673
16731674 // These types aren't intended to be pub, but are exposed for direct fuzzing (as we deserialize
16741675 // them from untrusted input):
@@ -1695,6 +1696,13 @@ mod fuzzy_internal_msgs {
16951696 amt_msat : u64 ,
16961697 outgoing_cltv_value : u32 ,
16971698 } ,
1699+ BlindedForward {
1700+ short_channel_id : u64 ,
1701+ payment_relay : PaymentRelay ,
1702+ payment_constraints : PaymentConstraints ,
1703+ features : BlindedHopFeatures ,
1704+ intro_node_blinding_point : PublicKey ,
1705+ } ,
16981706 BlindedReceive {
16991707 amt_msat : u64 ,
17001708 total_msat : u64 ,
@@ -2354,7 +2362,23 @@ impl<NS: Deref> ReadableArgs<&NS> for InboundOnionPayload where NS::Target: Node
23542362 let mut s = Cursor :: new ( & enc_tlvs) ;
23552363 let mut reader = FixedLengthReader :: new ( & mut s, enc_tlvs. len ( ) as u64 ) ;
23562364 match ChaChaPolyReadAdapter :: read ( & mut reader, rho) ? {
2357- ChaChaPolyReadAdapter { readable : ReceiveTlvs { payment_secret, payment_constraints } } => {
2365+ ChaChaPolyReadAdapter { readable : BlindedPaymentTlvs :: Forward ( ForwardTlvs {
2366+ short_channel_id, payment_relay, payment_constraints, features
2367+ } ) } => {
2368+ if amt. is_some ( ) || cltv_value. is_some ( ) || total_msat. is_some ( ) {
2369+ return Err ( DecodeError :: InvalidValue )
2370+ }
2371+ Ok ( Self :: BlindedForward {
2372+ short_channel_id,
2373+ payment_relay,
2374+ payment_constraints,
2375+ features,
2376+ intro_node_blinding_point : blinding_point,
2377+ } )
2378+ } ,
2379+ ChaChaPolyReadAdapter { readable : BlindedPaymentTlvs :: Receive ( ReceiveTlvs {
2380+ payment_secret, payment_constraints
2381+ } ) } => {
23582382 if total_msat. unwrap_or ( 0 ) > MAX_VALUE_MSAT { return Err ( DecodeError :: InvalidValue ) }
23592383 Ok ( Self :: BlindedReceive {
23602384 amt_msat : amt. ok_or ( DecodeError :: InvalidValue ) ?,
0 commit comments