@@ -13,7 +13,7 @@ use bitcoin::hashes::hmac::Hmac;
1313use bitcoin:: hashes:: sha256:: Hash as Sha256 ;
1414use bitcoin:: secp256k1:: { self , PublicKey , Secp256k1 , SecretKey } ;
1515
16- use crate :: blinded_path:: utils;
16+ use crate :: blinded_path:: utils:: { self , BlindedPathWithPadding } ;
1717use crate :: blinded_path:: { BlindedHop , BlindedPath , IntroductionNode , NodeIdLookUp } ;
1818use crate :: crypto:: streams:: ChaChaPolyReadAdapter ;
1919use crate :: io;
@@ -546,6 +546,10 @@ impl Readable for BlindedPaymentTlvs {
546546 }
547547}
548548
549+ /// Represents the padding round off size (in bytes) that
550+ /// is used to pad payment bilnded path's [`BlindedHop`]
551+ pub ( crate ) const PAYMENT_PADDING_ROUND_OFF : usize = 30 ;
552+
549553/// Construct blinded payment hops for the given `intermediate_nodes` and payee info.
550554pub ( super ) fn blinded_hops < T : secp256k1:: Signing + secp256k1:: Verification > (
551555 secp_ctx : & Secp256k1 < T > , intermediate_nodes : & [ PaymentForwardNode ] , payee_node_id : PublicKey ,
@@ -558,7 +562,9 @@ pub(super) fn blinded_hops<T: secp256k1::Signing + secp256k1::Verification>(
558562 . map ( |node| BlindedPaymentTlvsRef :: Forward ( & node. tlvs ) )
559563 . chain ( core:: iter:: once ( BlindedPaymentTlvsRef :: Receive ( & payee_tlvs) ) ) ;
560564
561- let path = pks. zip ( tlvs) ;
565+ let path = pks. zip (
566+ tlvs. map ( |tlv| BlindedPathWithPadding { tlvs : tlv, round_off : PAYMENT_PADDING_ROUND_OFF } ) ,
567+ ) ;
562568
563569 utils:: construct_blinded_hops ( secp_ctx, path, session_priv)
564570}
0 commit comments