@@ -894,20 +894,23 @@ mod tests {
894
894
let payment_id = Some ( invoice_payer. pay_invoice ( & invoice) . unwrap ( ) ) ;
895
895
assert_eq ! ( * payer. attempts. borrow( ) , 1 ) ;
896
896
897
+ {
898
+ let inflight_map = invoice_payer. create_inflight_map ( & payment_hash) ;
899
+ // TestRouter returns two hops, with `fee_msat` divided by two. The invoice instantiated above
900
+ // is hard-coded to test sending an invoice with a value of 128 msats.
901
+ assert_eq ! ( inflight_map. get( & ( 0 , true ) ) . unwrap( ) . clone( ) , 64 ) ;
902
+ assert_eq ! ( inflight_map. get( & ( 1 , true ) ) . unwrap( ) . clone( ) , 64 ) ;
903
+ }
904
+
897
905
invoice_payer. handle_event ( & Event :: PaymentSent {
898
906
payment_id, payment_preimage, payment_hash, fee_paid_msat : None
899
907
} ) ;
900
908
assert_eq ! ( * event_handled. borrow( ) , true ) ;
901
909
assert_eq ! ( * payer. attempts. borrow( ) , 1 ) ;
902
910
903
- invoice_payer. handle_event ( & Event :: PaymentPathSuccessful {
904
- payment_id : payment_id. unwrap ( ) , payment_hash : Some ( payment_hash) ,
905
- path : TestRouter :: route_for_value ( final_value_msat) . paths [ 0 ] . clone ( )
906
- } ) ;
907
- invoice_payer. handle_event ( & Event :: PaymentPathSuccessful {
908
- payment_id : payment_id. unwrap ( ) , payment_hash : Some ( payment_hash) ,
909
- path : TestRouter :: route_for_value ( final_value_msat) . paths [ 1 ] . clone ( )
910
- } ) ;
911
+ // We should have cleared the payment_cache of information about this payment
912
+ let inflight_map = invoice_payer. create_inflight_map ( & payment_hash) ;
913
+ assert_eq ! ( inflight_map. len( ) , 0 )
911
914
}
912
915
913
916
#[ test]
@@ -951,15 +954,6 @@ mod tests {
951
954
} ) ;
952
955
assert_eq ! ( * event_handled. borrow( ) , true ) ;
953
956
assert_eq ! ( * payer. attempts. borrow( ) , 2 ) ;
954
-
955
- invoice_payer. handle_event ( & Event :: PaymentPathSuccessful {
956
- payment_id : payment_id. unwrap ( ) , payment_hash : Some ( payment_hash) ,
957
- path : TestRouter :: route_for_value ( final_value_msat) . paths [ 0 ] . clone ( )
958
- } ) ;
959
- invoice_payer. handle_event ( & Event :: PaymentPathSuccessful {
960
- payment_id : payment_id. unwrap ( ) , payment_hash : Some ( payment_hash) ,
961
- path : TestRouter :: route_for_value ( final_value_msat) . paths [ 1 ] . clone ( )
962
- } ) ;
963
957
}
964
958
965
959
#[ test]
0 commit comments