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