@@ -14,7 +14,7 @@ use bitcoin::hashes::sha256::Hash as Sha256;
1414use bitcoin:: secp256k1:: { self , PublicKey , Secp256k1 , SecretKey } ;
1515
1616use crate :: blinded_path:: { BlindedHop , BlindedPath , IntroductionNode , NodeIdLookUp } ;
17- use crate :: blinded_path:: utils;
17+ use crate :: blinded_path:: utils:: { self , BlindedPathWithPadding } ;
1818use crate :: crypto:: streams:: ChaChaPolyReadAdapter ;
1919use crate :: io;
2020use crate :: io:: Cursor ;
@@ -495,6 +495,10 @@ impl Readable for BlindedPaymentTlvs {
495495 }
496496}
497497
498+ /// Represents the padding round off size (in bytes) that
499+ /// is used to pad payment bilnded path's [`BlindedHop`]
500+ pub ( crate ) const PAYMENT_PADDING_ROUND_OFF : usize = 35 ;
501+
498502/// Construct blinded payment hops for the given `intermediate_nodes` and payee info.
499503pub ( super ) fn blinded_hops < T : secp256k1:: Signing + secp256k1:: Verification > (
500504 secp_ctx : & Secp256k1 < T > , intermediate_nodes : & [ PaymentForwardNode ] ,
@@ -505,7 +509,7 @@ pub(super) fn blinded_hops<T: secp256k1::Signing + secp256k1::Verification>(
505509 let tlvs = intermediate_nodes. iter ( ) . map ( |node| BlindedPaymentTlvsRef :: Forward ( & node. tlvs ) )
506510 . chain ( core:: iter:: once ( BlindedPaymentTlvsRef :: Receive ( & payee_tlvs) ) ) ;
507511
508- let path = pks. zip ( tlvs) ;
512+ let path = pks. zip ( tlvs. map ( |tlv| BlindedPathWithPadding { tlvs : tlv , round_off : PAYMENT_PADDING_ROUND_OFF } ) ) ;
509513
510514 utils:: construct_blinded_hops ( secp_ctx, path, session_priv)
511515}
0 commit comments