@@ -14,7 +14,7 @@ use bitcoin::hashes::sha256::Hash as Sha256;
1414use bitcoin:: secp256k1:: ecdh:: SharedSecret ;
1515use bitcoin:: secp256k1:: { self , PublicKey , Secp256k1 , SecretKey } ;
1616
17- use crate :: blinded_path:: utils;
17+ use crate :: blinded_path:: utils:: { self , BlindedPathWithPadding } ;
1818use crate :: blinded_path:: { BlindedHop , BlindedPath , IntroductionNode , NodeIdLookUp } ;
1919use crate :: crypto:: streams:: ChaChaPolyReadAdapter ;
2020use crate :: io;
@@ -560,6 +560,10 @@ impl Readable for BlindedPaymentTlvs {
560560 }
561561}
562562
563+ /// Represents the padding round off size (in bytes) that
564+ /// is used to pad payment bilnded path's [`BlindedHop`]
565+ pub ( crate ) const PAYMENT_PADDING_ROUND_OFF : usize = 30 ;
566+
563567/// Construct blinded payment hops for the given `intermediate_nodes` and payee info.
564568pub ( super ) fn blinded_hops < T : secp256k1:: Signing + secp256k1:: Verification > (
565569 secp_ctx : & Secp256k1 < T > , intermediate_nodes : & [ PaymentForwardNode ] , payee_node_id : PublicKey ,
@@ -572,7 +576,9 @@ pub(super) fn blinded_hops<T: secp256k1::Signing + secp256k1::Verification>(
572576 . map ( |node| BlindedPaymentTlvsRef :: Forward ( & node. tlvs ) )
573577 . chain ( core:: iter:: once ( BlindedPaymentTlvsRef :: Receive ( & payee_tlvs) ) ) ;
574578
575- let path = pks. zip ( tlvs) ;
579+ let path = pks. zip (
580+ tlvs. map ( |tlv| BlindedPathWithPadding { tlvs : tlv, round_off : PAYMENT_PADDING_ROUND_OFF } ) ,
581+ ) ;
576582
577583 utils:: construct_blinded_hops ( secp_ctx, path, session_priv)
578584}
0 commit comments