@@ -565,6 +565,7 @@ mod tests {
565
565
use crate :: offers:: invoice:: InvoiceTlvStreamRef ;
566
566
use crate :: offers:: merkle;
567
567
use crate :: offers:: merkle:: { SignatureTlvStreamRef , TaggedHash } ;
568
+ use crate :: offers:: nonce:: Nonce ;
568
569
use crate :: offers:: offer:: { Offer , OfferBuilder , OfferTlvStreamRef , Quantity } ;
569
570
use crate :: offers:: parse:: { Bolt12ParseError , Bolt12SemanticError } ;
570
571
use crate :: offers:: static_invoice:: {
@@ -608,13 +609,13 @@ mod tests {
608
609
let now = now ( ) ;
609
610
let expanded_key = ExpandedKey :: new ( & KeyMaterial ( [ 42 ; 32 ] ) ) ;
610
611
let entropy = FixedEntropy { } ;
612
+ let nonce = Nonce :: from_entropy_source ( & entropy) ;
611
613
let secp_ctx = Secp256k1 :: new ( ) ;
612
614
613
- let offer =
614
- OfferBuilder :: deriving_signing_pubkey ( node_id, & expanded_key, & entropy, & secp_ctx)
615
- . path ( blinded_path ( ) )
616
- . build ( )
617
- . unwrap ( ) ;
615
+ let offer = OfferBuilder :: deriving_signing_pubkey ( node_id, & expanded_key, nonce, & secp_ctx)
616
+ . path ( blinded_path ( ) )
617
+ . build ( )
618
+ . unwrap ( ) ;
618
619
619
620
StaticInvoiceBuilder :: for_offer_using_derived_keys (
620
621
& offer,
@@ -647,13 +648,13 @@ mod tests {
647
648
let now = now ( ) ;
648
649
let expanded_key = ExpandedKey :: new ( & KeyMaterial ( [ 42 ; 32 ] ) ) ;
649
650
let entropy = FixedEntropy { } ;
651
+ let nonce = Nonce :: from_entropy_source ( & entropy) ;
650
652
let secp_ctx = Secp256k1 :: new ( ) ;
651
653
652
- let offer =
653
- OfferBuilder :: deriving_signing_pubkey ( node_id, & expanded_key, & entropy, & secp_ctx)
654
- . path ( blinded_path ( ) )
655
- . build ( )
656
- . unwrap ( ) ;
654
+ let offer = OfferBuilder :: deriving_signing_pubkey ( node_id, & expanded_key, nonce, & secp_ctx)
655
+ . path ( blinded_path ( ) )
656
+ . build ( )
657
+ . unwrap ( ) ;
657
658
658
659
let invoice = StaticInvoiceBuilder :: for_offer_using_derived_keys (
659
660
& offer,
@@ -742,13 +743,14 @@ mod tests {
742
743
let now = now ( ) ;
743
744
let expanded_key = ExpandedKey :: new ( & KeyMaterial ( [ 42 ; 32 ] ) ) ;
744
745
let entropy = FixedEntropy { } ;
746
+ let nonce = Nonce :: from_entropy_source ( & entropy) ;
745
747
let secp_ctx = Secp256k1 :: new ( ) ;
746
748
747
749
let future_expiry = Duration :: from_secs ( u64:: max_value ( ) ) ;
748
750
let past_expiry = Duration :: from_secs ( 0 ) ;
749
751
750
752
let valid_offer =
751
- OfferBuilder :: deriving_signing_pubkey ( node_id, & expanded_key, & entropy , & secp_ctx)
753
+ OfferBuilder :: deriving_signing_pubkey ( node_id, & expanded_key, nonce , & secp_ctx)
752
754
. path ( blinded_path ( ) )
753
755
. absolute_expiry ( future_expiry)
754
756
. build ( )
@@ -769,7 +771,7 @@ mod tests {
769
771
assert_eq ! ( invoice. absolute_expiry( ) , Some ( future_expiry) ) ;
770
772
771
773
let expired_offer =
772
- OfferBuilder :: deriving_signing_pubkey ( node_id, & expanded_key, & entropy , & secp_ctx)
774
+ OfferBuilder :: deriving_signing_pubkey ( node_id, & expanded_key, nonce , & secp_ctx)
773
775
. path ( blinded_path ( ) )
774
776
. absolute_expiry ( past_expiry)
775
777
. build ( )
@@ -797,10 +799,11 @@ mod tests {
797
799
let now = now ( ) ;
798
800
let expanded_key = ExpandedKey :: new ( & KeyMaterial ( [ 42 ; 32 ] ) ) ;
799
801
let entropy = FixedEntropy { } ;
802
+ let nonce = Nonce :: from_entropy_source ( & entropy) ;
800
803
let secp_ctx = Secp256k1 :: new ( ) ;
801
804
802
805
let valid_offer =
803
- OfferBuilder :: deriving_signing_pubkey ( node_id, & expanded_key, & entropy , & secp_ctx)
806
+ OfferBuilder :: deriving_signing_pubkey ( node_id, & expanded_key, nonce , & secp_ctx)
804
807
. path ( blinded_path ( ) )
805
808
. build ( )
806
809
. unwrap ( ) ;
@@ -860,10 +863,11 @@ mod tests {
860
863
let now = now ( ) ;
861
864
let expanded_key = ExpandedKey :: new ( & KeyMaterial ( [ 42 ; 32 ] ) ) ;
862
865
let entropy = FixedEntropy { } ;
866
+ let nonce = Nonce :: from_entropy_source ( & entropy) ;
863
867
let secp_ctx = Secp256k1 :: new ( ) ;
864
868
865
869
let valid_offer =
866
- OfferBuilder :: deriving_signing_pubkey ( node_id, & expanded_key, & entropy , & secp_ctx)
870
+ OfferBuilder :: deriving_signing_pubkey ( node_id, & expanded_key, nonce , & secp_ctx)
867
871
. path ( blinded_path ( ) )
868
872
. build ( )
869
873
. unwrap ( ) ;
@@ -916,10 +920,11 @@ mod tests {
916
920
let now = now ( ) ;
917
921
let expanded_key = ExpandedKey :: new ( & KeyMaterial ( [ 42 ; 32 ] ) ) ;
918
922
let entropy = FixedEntropy { } ;
923
+ let nonce = Nonce :: from_entropy_source ( & entropy) ;
919
924
let secp_ctx = Secp256k1 :: new ( ) ;
920
925
921
926
let offer_with_extra_chain =
922
- OfferBuilder :: deriving_signing_pubkey ( node_id, & expanded_key, & entropy , & secp_ctx)
927
+ OfferBuilder :: deriving_signing_pubkey ( node_id, & expanded_key, nonce , & secp_ctx)
923
928
. path ( blinded_path ( ) )
924
929
. chain ( Network :: Bitcoin )
925
930
. chain ( Network :: Testnet )
@@ -947,13 +952,13 @@ mod tests {
947
952
let now = now ( ) ;
948
953
let expanded_key = ExpandedKey :: new ( & KeyMaterial ( [ 42 ; 32 ] ) ) ;
949
954
let entropy = FixedEntropy { } ;
955
+ let nonce = Nonce :: from_entropy_source ( & entropy) ;
950
956
let secp_ctx = Secp256k1 :: new ( ) ;
951
957
952
- let offer =
953
- OfferBuilder :: deriving_signing_pubkey ( node_id, & expanded_key, & entropy, & secp_ctx)
954
- . path ( blinded_path ( ) )
955
- . build ( )
956
- . unwrap ( ) ;
958
+ let offer = OfferBuilder :: deriving_signing_pubkey ( node_id, & expanded_key, nonce, & secp_ctx)
959
+ . path ( blinded_path ( ) )
960
+ . build ( )
961
+ . unwrap ( ) ;
957
962
958
963
const TEST_RELATIVE_EXPIRY : u32 = 3600 ;
959
964
let invoice = StaticInvoiceBuilder :: for_offer_using_derived_keys (
@@ -988,13 +993,13 @@ mod tests {
988
993
let now = now ( ) ;
989
994
let expanded_key = ExpandedKey :: new ( & KeyMaterial ( [ 42 ; 32 ] ) ) ;
990
995
let entropy = FixedEntropy { } ;
996
+ let nonce = Nonce :: from_entropy_source ( & entropy) ;
991
997
let secp_ctx = Secp256k1 :: new ( ) ;
992
998
993
- let offer =
994
- OfferBuilder :: deriving_signing_pubkey ( node_id, & expanded_key, & entropy, & secp_ctx)
995
- . path ( blinded_path ( ) )
996
- . build ( )
997
- . unwrap ( ) ;
999
+ let offer = OfferBuilder :: deriving_signing_pubkey ( node_id, & expanded_key, nonce, & secp_ctx)
1000
+ . path ( blinded_path ( ) )
1001
+ . build ( )
1002
+ . unwrap ( ) ;
998
1003
999
1004
let invoice = StaticInvoiceBuilder :: for_offer_using_derived_keys (
1000
1005
& offer,
0 commit comments