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 @@ -1813,4 +1813,26 @@ mod tests {
1813
1813
1814
1814
assert ! ( outbound_payments. add_new_awaiting_invoice( payment_id) . is_err( ) ) ;
1815
1815
}
1816
+
1817
+ #[ test]
1818
+ fn removes_abandoned_awaiting_invoice ( ) {
1819
+ let pending_events = Mutex :: new ( VecDeque :: new ( ) ) ;
1820
+ let outbound_payments = OutboundPayments :: new ( ) ;
1821
+ let payment_id = PaymentId ( [ 0 ; 32 ] ) ;
1822
+
1823
+ assert ! ( !outbound_payments. has_pending_payments( ) ) ;
1824
+ assert ! ( outbound_payments. add_new_awaiting_invoice( payment_id) . is_ok( ) ) ;
1825
+ assert ! ( outbound_payments. has_pending_payments( ) ) ;
1826
+
1827
+ outbound_payments. abandon_payment (
1828
+ payment_id, PaymentFailureReason :: UserAbandoned , & pending_events
1829
+ ) ;
1830
+ assert ! ( !outbound_payments. has_pending_payments( ) ) ;
1831
+ assert ! ( !pending_events. lock( ) . unwrap( ) . is_empty( ) ) ;
1832
+ assert_eq ! (
1833
+ pending_events. lock( ) . unwrap( ) . pop_front( ) ,
1834
+ Some ( ( Event :: InvoiceRequestFailed { payment_id } , None ) ) ,
1835
+ ) ;
1836
+ assert ! ( pending_events. lock( ) . unwrap( ) . is_empty( ) ) ;
1837
+ }
1816
1838
}
You can’t perform that action at this time.
0 commit comments