@@ -31,7 +31,7 @@ use bitcoin::{secp256k1, Witness};
31
31
use bitcoin:: blockdata:: script:: ScriptBuf ;
32
32
use bitcoin:: hash_types:: Txid ;
33
33
34
- use crate :: blinded_path:: payment:: ReceiveTlvs ;
34
+ use crate :: blinded_path:: payment:: { BlindedPaymentTlvs , ForwardTlvs , ReceiveTlvs } ;
35
35
use crate :: ln:: { ChannelId , PaymentPreimage , PaymentHash , PaymentSecret } ;
36
36
use crate :: ln:: features:: { ChannelFeatures , ChannelTypeFeatures , InitFeatures , NodeFeatures } ;
37
37
use crate :: ln:: onion_utils;
@@ -1666,9 +1666,10 @@ pub trait OnionMessageHandler {
1666
1666
1667
1667
mod fuzzy_internal_msgs {
1668
1668
use bitcoin:: secp256k1:: PublicKey ;
1669
- use crate :: blinded_path:: payment:: PaymentConstraints ;
1669
+ use crate :: blinded_path:: payment:: { PaymentConstraints , PaymentRelay } ;
1670
1670
use crate :: prelude:: * ;
1671
1671
use crate :: ln:: { PaymentPreimage , PaymentSecret } ;
1672
+ use crate :: ln:: features:: BlindedHopFeatures ;
1672
1673
1673
1674
// These types aren't intended to be pub, but are exposed for direct fuzzing (as we deserialize
1674
1675
// them from untrusted input):
@@ -1695,6 +1696,13 @@ mod fuzzy_internal_msgs {
1695
1696
amt_msat : u64 ,
1696
1697
outgoing_cltv_value : u32 ,
1697
1698
} ,
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
+ } ,
1698
1706
BlindedReceive {
1699
1707
amt_msat : u64 ,
1700
1708
total_msat : u64 ,
@@ -2354,7 +2362,23 @@ impl<NS: Deref> ReadableArgs<&NS> for InboundOnionPayload where NS::Target: Node
2354
2362
let mut s = Cursor :: new ( & enc_tlvs) ;
2355
2363
let mut reader = FixedLengthReader :: new ( & mut s, enc_tlvs. len ( ) as u64 ) ;
2356
2364
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
+ } ) } => {
2358
2382
if total_msat. unwrap_or ( 0 ) > MAX_VALUE_MSAT { return Err ( DecodeError :: InvalidValue ) }
2359
2383
Ok ( Self :: BlindedReceive {
2360
2384
amt_msat : amt. ok_or ( DecodeError :: InvalidValue ) ?,
0 commit comments