@@ -16,7 +16,7 @@ use crate::chain::channelmonitor::{ANTI_REORG_DELAY, LATENCY_GRACE_PERIOD_BLOCKS
16
16
use crate :: chain:: transaction:: OutPoint ;
17
17
use crate :: chain:: keysinterface:: KeysInterface ;
18
18
use crate :: ln:: channel:: EXPIRE_PREV_CONFIG_TICKS ;
19
- use crate :: ln:: channelmanager:: { self , BREAKDOWN_TIMEOUT , ChannelManager , MPP_TIMEOUT_TICKS , MIN_CLTV_EXPIRY_DELTA , PaymentId , PaymentSendFailure , IDEMPOTENCY_TIMEOUT_TICKS } ;
19
+ use crate :: ln:: channelmanager:: { self , BREAKDOWN_TIMEOUT , ChannelManager , MPP_TIMEOUT_TICKS , MIN_CLTV_EXPIRY_DELTA , PaymentId , PendingPaymentStatus , PaymentSendFailure , IDEMPOTENCY_TIMEOUT_TICKS } ;
20
20
use crate :: ln:: msgs;
21
21
use crate :: ln:: msgs:: ChannelMessageHandler ;
22
22
use crate :: routing:: router:: { PaymentParameters , get_route} ;
@@ -1279,6 +1279,15 @@ fn test_trivial_inflight_htlc_tracking(){
1279
1279
1280
1280
assert_eq ! ( chan_1_used_liquidity, None ) ;
1281
1281
assert_eq ! ( chan_2_used_liquidity, None ) ;
1282
+
1283
+ let pending_payments = nodes[ 0 ] . node . list_pending_payments ( ) ;
1284
+ assert_eq ! ( pending_payments. len( ) , 1 ) ;
1285
+ assert_eq ! ( pending_payments[ 0 ] . status, PendingPaymentStatus :: Fulfilled ) ;
1286
+ }
1287
+
1288
+ // Remove fulfilled payment
1289
+ for _ in 0 ..=IDEMPOTENCY_TIMEOUT_TICKS {
1290
+ nodes[ 0 ] . node . timer_tick_occurred ( ) ;
1282
1291
}
1283
1292
1284
1293
// Send the payment, but do not claim it. Our inflight HTLCs should contain the pending payment.
@@ -1305,10 +1314,21 @@ fn test_trivial_inflight_htlc_tracking(){
1305
1314
// First hop accounts for expected 1000 msat fee
1306
1315
assert_eq ! ( chan_1_used_liquidity, Some ( 501000 ) ) ;
1307
1316
assert_eq ! ( chan_2_used_liquidity, Some ( 500000 ) ) ;
1317
+
1318
+ let pending_payments = nodes[ 0 ] . node . list_pending_payments ( ) ;
1319
+ assert_eq ! ( pending_payments. len( ) , 1 ) ;
1320
+ assert_eq ! ( pending_payments[ 0 ] . status, PendingPaymentStatus :: Retryable ) ;
1321
+ assert_eq ! ( pending_payments[ 0 ] . total_msat, Some ( 500000 ) ) ;
1308
1322
}
1309
1323
1310
1324
// Now, let's claim the payment. This should result in the used liquidity to return `None`.
1311
1325
claim_payment ( & nodes[ 0 ] , & [ & nodes[ 1 ] , & nodes[ 2 ] ] , payment_preimage) ;
1326
+
1327
+ // Remove fulfilled payment
1328
+ for _ in 0 ..=IDEMPOTENCY_TIMEOUT_TICKS {
1329
+ nodes[ 0 ] . node . timer_tick_occurred ( ) ;
1330
+ }
1331
+
1312
1332
{
1313
1333
let inflight_htlcs = node_chanmgrs[ 0 ] . compute_inflight_htlcs ( ) ;
1314
1334
@@ -1330,6 +1350,9 @@ fn test_trivial_inflight_htlc_tracking(){
1330
1350
1331
1351
assert_eq ! ( chan_1_used_liquidity, None ) ;
1332
1352
assert_eq ! ( chan_2_used_liquidity, None ) ;
1353
+
1354
+ let pending_payments = nodes[ 0 ] . node . list_pending_payments ( ) ;
1355
+ assert_eq ! ( pending_payments. len( ) , 0 ) ;
1333
1356
}
1334
1357
}
1335
1358
0 commit comments