@@ -1556,6 +1556,7 @@ mod tests {
1556
1556
assert_eq ! ( invoice. payment_hash( ) , payment_hash) ;
1557
1557
assert ! ( invoice. fallbacks( ) . is_empty( ) ) ;
1558
1558
assert_eq ! ( invoice. invoice_features( ) , & Bolt12InvoiceFeatures :: empty( ) ) ;
1559
+ assert ! ( !invoice. is_for_refund_without_paths( ) ) ;
1559
1560
1560
1561
let message = TaggedHash :: from_valid_tlv_stream_bytes ( SIGNATURE_TAG , & invoice. bytes ) ;
1561
1562
assert ! ( merkle:: verify_signature( & invoice. signature, & message, recipient_pubkey( ) ) . is_ok( ) ) ;
@@ -1653,6 +1654,7 @@ mod tests {
1653
1654
assert_eq ! ( invoice. payment_hash( ) , payment_hash) ;
1654
1655
assert ! ( invoice. fallbacks( ) . is_empty( ) ) ;
1655
1656
assert_eq ! ( invoice. invoice_features( ) , & Bolt12InvoiceFeatures :: empty( ) ) ;
1657
+ assert ! ( invoice. is_for_refund_without_paths( ) ) ;
1656
1658
1657
1659
let message = TaggedHash :: from_valid_tlv_stream_bytes ( SIGNATURE_TAG , & invoice. bytes ) ;
1658
1660
assert ! ( merkle:: verify_signature( & invoice. signature, & message, recipient_pubkey( ) ) . is_ok( ) ) ;
@@ -1845,6 +1847,37 @@ mod tests {
1845
1847
}
1846
1848
}
1847
1849
1850
+ #[ test]
1851
+ fn builds_invoice_from_refund_with_path ( ) {
1852
+ let node_id = payer_pubkey ( ) ;
1853
+ let expanded_key = ExpandedKey :: new ( & KeyMaterial ( [ 42 ; 32 ] ) ) ;
1854
+ let entropy = FixedEntropy { } ;
1855
+ let secp_ctx = Secp256k1 :: new ( ) ;
1856
+
1857
+ let blinded_path = BlindedPath {
1858
+ introduction_node : IntroductionNode :: NodeId ( pubkey ( 40 ) ) ,
1859
+ blinding_point : pubkey ( 41 ) ,
1860
+ blinded_hops : vec ! [
1861
+ BlindedHop { blinded_node_id: pubkey( 42 ) , encrypted_payload: vec![ 0 ; 43 ] } ,
1862
+ BlindedHop { blinded_node_id: node_id, encrypted_payload: vec![ 0 ; 44 ] } ,
1863
+ ] ,
1864
+ } ;
1865
+
1866
+ let refund = RefundBuilder :: new ( vec ! [ 1 ; 32 ] , payer_pubkey ( ) , 1000 ) . unwrap ( )
1867
+ . path ( blinded_path)
1868
+ . build ( ) . unwrap ( ) ;
1869
+
1870
+ let invoice = refund
1871
+ . respond_using_derived_keys_no_std (
1872
+ payment_paths ( ) , payment_hash ( ) , now ( ) , & expanded_key, & entropy
1873
+ )
1874
+ . unwrap ( )
1875
+ . build_and_sign ( & secp_ctx)
1876
+ . unwrap ( ) ;
1877
+ assert ! ( !invoice. message_paths( ) . is_empty( ) ) ;
1878
+ assert ! ( !invoice. is_for_refund_without_paths( ) ) ;
1879
+ }
1880
+
1848
1881
#[ test]
1849
1882
fn builds_invoice_with_relative_expiry ( ) {
1850
1883
let now = now ( ) ;
0 commit comments