@@ -197,15 +197,14 @@ macro_rules! refund_builder_methods { (
197197 ///
198198 /// [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest
199199 /// [`ExpandedKey`]: crate::ln::inbound_payment::ExpandedKey
200- pub fn deriving_payer_id< ES : Deref > (
201- node_id: PublicKey , expanded_key: & ExpandedKey , entropy_source : ES ,
200+ pub fn deriving_payer_id(
201+ node_id: PublicKey , expanded_key: & ExpandedKey , nonce : Nonce ,
202202 secp_ctx: & ' a Secp256k1 <$secp_context>, amount_msats: u64 , payment_id: PaymentId
203- ) -> Result <Self , Bolt12SemanticError > where ES :: Target : EntropySource {
203+ ) -> Result <Self , Bolt12SemanticError > {
204204 if amount_msats > MAX_VALUE_MSAT {
205205 return Err ( Bolt12SemanticError :: InvalidAmount ) ;
206206 }
207207
208- let nonce = Nonce :: from_entropy_source( entropy_source) ;
209208 let payment_id = Some ( payment_id) ;
210209 let derivation_material = MetadataMaterial :: new( nonce, expanded_key, IV_BYTES , payment_id) ;
211210 let metadata = Metadata :: DerivedSigningPubkey ( derivation_material) ;
@@ -940,6 +939,7 @@ mod tests {
940939 use crate :: ln:: inbound_payment:: ExpandedKey ;
941940 use crate :: ln:: msgs:: { DecodeError , MAX_VALUE_MSAT } ;
942941 use crate :: offers:: invoice_request:: InvoiceRequestTlvStreamRef ;
942+ use crate :: offers:: nonce:: Nonce ;
943943 use crate :: offers:: offer:: OfferTlvStreamRef ;
944944 use crate :: offers:: parse:: { Bolt12ParseError , Bolt12SemanticError } ;
945945 use crate :: offers:: payer:: PayerTlvStreamRef ;
@@ -1029,11 +1029,12 @@ mod tests {
10291029 let node_id = payer_pubkey ( ) ;
10301030 let expanded_key = ExpandedKey :: new ( & KeyMaterial ( [ 42 ; 32 ] ) ) ;
10311031 let entropy = FixedEntropy { } ;
1032+ let nonce = Nonce :: from_entropy_source ( & entropy) ;
10321033 let secp_ctx = Secp256k1 :: new ( ) ;
10331034 let payment_id = PaymentId ( [ 1 ; 32 ] ) ;
10341035
10351036 let refund = RefundBuilder
1036- :: deriving_payer_id ( node_id, & expanded_key, & entropy , & secp_ctx, 1000 , payment_id)
1037+ :: deriving_payer_id ( node_id, & expanded_key, nonce , & secp_ctx, 1000 , payment_id)
10371038 . unwrap ( )
10381039 . build ( ) . unwrap ( ) ;
10391040 assert_eq ! ( refund. payer_id( ) , node_id) ;
@@ -1083,6 +1084,7 @@ mod tests {
10831084 let node_id = payer_pubkey ( ) ;
10841085 let expanded_key = ExpandedKey :: new ( & KeyMaterial ( [ 42 ; 32 ] ) ) ;
10851086 let entropy = FixedEntropy { } ;
1087+ let nonce = Nonce :: from_entropy_source ( & entropy) ;
10861088 let secp_ctx = Secp256k1 :: new ( ) ;
10871089 let payment_id = PaymentId ( [ 1 ; 32 ] ) ;
10881090
@@ -1096,7 +1098,7 @@ mod tests {
10961098 } ;
10971099
10981100 let refund = RefundBuilder
1099- :: deriving_payer_id ( node_id, & expanded_key, & entropy , & secp_ctx, 1000 , payment_id)
1101+ :: deriving_payer_id ( node_id, & expanded_key, nonce , & secp_ctx, 1000 , payment_id)
11001102 . unwrap ( )
11011103 . path ( blinded_path)
11021104 . build ( ) . unwrap ( ) ;
0 commit comments