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