@@ -197,15 +197,14 @@ macro_rules! refund_builder_methods { (
197
197
///
198
198
/// [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest
199
199
/// [`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 ,
202
202
secp_ctx: & ' a Secp256k1 <$secp_context>, amount_msats: u64 , payment_id: PaymentId
203
- ) -> Result <Self , Bolt12SemanticError > where ES :: Target : EntropySource {
203
+ ) -> Result <Self , Bolt12SemanticError > {
204
204
if amount_msats > MAX_VALUE_MSAT {
205
205
return Err ( Bolt12SemanticError :: InvalidAmount ) ;
206
206
}
207
207
208
- let nonce = Nonce :: from_entropy_source( entropy_source) ;
209
208
let payment_id = Some ( payment_id) ;
210
209
let derivation_material = MetadataMaterial :: new( nonce, expanded_key, IV_BYTES , payment_id) ;
211
210
let metadata = Metadata :: DerivedSigningPubkey ( derivation_material) ;
@@ -940,6 +939,7 @@ mod tests {
940
939
use crate :: ln:: inbound_payment:: ExpandedKey ;
941
940
use crate :: ln:: msgs:: { DecodeError , MAX_VALUE_MSAT } ;
942
941
use crate :: offers:: invoice_request:: InvoiceRequestTlvStreamRef ;
942
+ use crate :: offers:: nonce:: Nonce ;
943
943
use crate :: offers:: offer:: OfferTlvStreamRef ;
944
944
use crate :: offers:: parse:: { Bolt12ParseError , Bolt12SemanticError } ;
945
945
use crate :: offers:: payer:: PayerTlvStreamRef ;
@@ -1029,11 +1029,12 @@ mod tests {
1029
1029
let node_id = payer_pubkey ( ) ;
1030
1030
let expanded_key = ExpandedKey :: new ( & KeyMaterial ( [ 42 ; 32 ] ) ) ;
1031
1031
let entropy = FixedEntropy { } ;
1032
+ let nonce = Nonce :: from_entropy_source ( & entropy) ;
1032
1033
let secp_ctx = Secp256k1 :: new ( ) ;
1033
1034
let payment_id = PaymentId ( [ 1 ; 32 ] ) ;
1034
1035
1035
1036
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)
1037
1038
. unwrap ( )
1038
1039
. build ( ) . unwrap ( ) ;
1039
1040
assert_eq ! ( refund. payer_id( ) , node_id) ;
@@ -1083,6 +1084,7 @@ mod tests {
1083
1084
let node_id = payer_pubkey ( ) ;
1084
1085
let expanded_key = ExpandedKey :: new ( & KeyMaterial ( [ 42 ; 32 ] ) ) ;
1085
1086
let entropy = FixedEntropy { } ;
1087
+ let nonce = Nonce :: from_entropy_source ( & entropy) ;
1086
1088
let secp_ctx = Secp256k1 :: new ( ) ;
1087
1089
let payment_id = PaymentId ( [ 1 ; 32 ] ) ;
1088
1090
@@ -1096,7 +1098,7 @@ mod tests {
1096
1098
} ;
1097
1099
1098
1100
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)
1100
1102
. unwrap ( )
1101
1103
. path ( blinded_path)
1102
1104
. build ( ) . unwrap ( ) ;
0 commit comments