File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -1816,4 +1816,26 @@ mod tests {
1816
1816
1817
1817
assert ! ( outbound_payments. add_new_awaiting_invoice( payment_id) . is_err( ) ) ;
1818
1818
}
1819
+
1820
+ #[ test]
1821
+ fn removes_abandoned_awaiting_invoice ( ) {
1822
+ let pending_events = Mutex :: new ( VecDeque :: new ( ) ) ;
1823
+ let outbound_payments = OutboundPayments :: new ( ) ;
1824
+ let payment_id = PaymentId ( [ 0 ; 32 ] ) ;
1825
+
1826
+ assert ! ( !outbound_payments. has_pending_payments( ) ) ;
1827
+ assert ! ( outbound_payments. add_new_awaiting_invoice( payment_id) . is_ok( ) ) ;
1828
+ assert ! ( outbound_payments. has_pending_payments( ) ) ;
1829
+
1830
+ outbound_payments. abandon_payment (
1831
+ payment_id, PaymentFailureReason :: UserAbandoned , & pending_events
1832
+ ) ;
1833
+ assert ! ( !outbound_payments. has_pending_payments( ) ) ;
1834
+ assert ! ( !pending_events. lock( ) . unwrap( ) . is_empty( ) ) ;
1835
+ assert_eq ! (
1836
+ pending_events. lock( ) . unwrap( ) . pop_front( ) ,
1837
+ Some ( ( Event :: InvoiceRequestFailed { payment_id } , None ) ) ,
1838
+ ) ;
1839
+ assert ! ( pending_events. lock( ) . unwrap( ) . is_empty( ) ) ;
1840
+ }
1819
1841
}
You can’t perform that action at this time.
0 commit comments