@@ -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 ;
@@ -493,6 +493,10 @@ impl Readable for BlindedPaymentTlvs {
493493 }
494494}
495495
496+ /// Represents the padding round off size (in bytes) that
497+ /// is used to pad payment bilnded path's [`BlindedHop`]
498+ pub ( crate ) const PAYMENT_PADDING_ROUND_OFF : usize = 35 ;
499+
496500/// Construct blinded payment hops for the given `intermediate_nodes` and payee info.
497501pub ( super ) fn blinded_hops < T : secp256k1:: Signing + secp256k1:: Verification > (
498502 secp_ctx : & Secp256k1 < T > , intermediate_nodes : & [ PaymentForwardNode ] ,
@@ -503,7 +507,7 @@ pub(super) fn blinded_hops<T: secp256k1::Signing + secp256k1::Verification>(
503507 let tlvs = intermediate_nodes. iter ( ) . map ( |node| BlindedPaymentTlvsRef :: Forward ( & node. tlvs ) )
504508 . chain ( core:: iter:: once ( BlindedPaymentTlvsRef :: Receive ( & payee_tlvs) ) ) ;
505509
506- let path = pks. zip ( tlvs) ;
510+ let path = pks. zip ( tlvs. map ( |tlv| BlindedPathWithPadding { tlvs : tlv , round_off : PAYMENT_PADDING_ROUND_OFF } ) ) ;
507511
508512 utils:: construct_blinded_hops ( secp_ctx, path, session_priv)
509513}
0 commit comments