File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -1622,4 +1622,28 @@ mod test {
1622
1622
let raw_invoice = builder. build_raw ( ) . unwrap ( ) ;
1623
1623
assert_eq ! ( raw_invoice, * invoice. into_signed_raw( ) . raw_invoice( ) )
1624
1624
}
1625
+
1626
+ #[ test]
1627
+ fn test_default_values ( ) {
1628
+ use :: * ;
1629
+ use secp256k1:: Secp256k1 ;
1630
+ use secp256k1:: key:: SecretKey ;
1631
+
1632
+ let signed_invoice = InvoiceBuilder :: new ( Currency :: Bitcoin )
1633
+ . description ( "Test" . into ( ) )
1634
+ . payment_hash ( sha256:: Hash :: from_slice ( & [ 0 ; 32 ] [ ..] ) . unwrap ( ) )
1635
+ . current_timestamp ( )
1636
+ . build_raw ( )
1637
+ . unwrap ( )
1638
+ . sign :: < _ , ( ) > ( |hash| {
1639
+ let privkey = SecretKey :: from_slice ( & [ 41 ; 32 ] ) . unwrap ( ) ;
1640
+ let secp_ctx = Secp256k1 :: new ( ) ;
1641
+ Ok ( secp_ctx. sign_recoverable ( hash, & privkey) )
1642
+ } )
1643
+ . unwrap ( ) ;
1644
+ let invoice = Invoice :: from_signed ( signed_invoice) . unwrap ( ) ;
1645
+
1646
+ assert_eq ! ( invoice. min_final_cltv_expiry( ) , DEFAULT_MIN_FINAL_CLTV_EXPIRY ) ;
1647
+ assert_eq ! ( invoice. expiry_time( ) , Duration :: from_secs( DEFAULT_EXPIRY_TIME ) ) ;
1648
+ }
1625
1649
}
You can’t perform that action at this time.
0 commit comments