@@ -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 , PendingPaymentDetails } ;
19
+ use crate :: ln:: channelmanager:: { self , BREAKDOWN_TIMEOUT , ChannelManager , MPP_TIMEOUT_TICKS , MIN_CLTV_EXPIRY_DELTA , PaymentId , PaymentSendFailure , IDEMPOTENCY_TIMEOUT_TICKS , RecentPaymentDetails } ;
20
20
use crate :: ln:: msgs;
21
21
use crate :: ln:: msgs:: ChannelMessageHandler ;
22
22
use crate :: routing:: router:: { PaymentParameters , get_route} ;
@@ -1257,7 +1257,11 @@ fn test_trivial_inflight_htlc_tracking(){
1257
1257
let ( _, _, chan_2_id, _) = create_announced_chan_between_nodes ( & nodes, 1 , 2 , channelmanager:: provided_init_features ( ) , channelmanager:: provided_init_features ( ) ) ;
1258
1258
1259
1259
// Send and claim the payment. Inflight HTLCs should be empty.
1260
- send_payment ( & nodes[ 0 ] , & vec ! ( & nodes[ 1 ] , & nodes[ 2 ] ) [ ..] , 500000 ) ;
1260
+ let ( route, payment_hash, payment_preimage, payment_secret) = get_route_and_payment_hash ! ( nodes[ 0 ] , nodes[ 2 ] , 500000 ) ;
1261
+ nodes[ 0 ] . node . send_payment ( & route, payment_hash, & Some ( payment_secret) , PaymentId ( payment_hash. 0 ) ) . unwrap ( ) ;
1262
+ check_added_monitors ! ( nodes[ 0 ] , 1 ) ;
1263
+ pass_along_route ( & nodes[ 0 ] , & [ & vec ! ( & nodes[ 1 ] , & nodes[ 2 ] ) [ ..] ] , 500000 , payment_hash, payment_secret) ;
1264
+ claim_payment ( & nodes[ 0 ] , & vec ! ( & nodes[ 1 ] , & nodes[ 2 ] ) [ ..] , payment_preimage) ;
1261
1265
{
1262
1266
let inflight_htlcs = node_chanmgrs[ 0 ] . compute_inflight_htlcs ( ) ;
1263
1267
@@ -1282,7 +1286,7 @@ fn test_trivial_inflight_htlc_tracking(){
1282
1286
1283
1287
let pending_payments = nodes[ 0 ] . node . list_pending_payments ( ) ;
1284
1288
assert_eq ! ( pending_payments. len( ) , 1 ) ;
1285
- assert_eq ! ( pending_payments[ 0 ] , PendingPaymentDetails :: Fulfilled ) ;
1289
+ assert_eq ! ( pending_payments[ 0 ] , RecentPaymentDetails :: Fulfilled { payment_hash : Some ( payment_hash ) } ) ;
1286
1290
}
1287
1291
1288
1292
// Remove fulfilled payment
@@ -1291,7 +1295,7 @@ fn test_trivial_inflight_htlc_tracking(){
1291
1295
}
1292
1296
1293
1297
// Send the payment, but do not claim it. Our inflight HTLCs should contain the pending payment.
1294
- let ( payment_preimage, _ , _) = route_payment ( & nodes[ 0 ] , & vec ! ( & nodes[ 1 ] , & nodes[ 2 ] ) [ ..] , 500000 ) ;
1298
+ let ( payment_preimage, payment_hash , _) = route_payment ( & nodes[ 0 ] , & vec ! ( & nodes[ 1 ] , & nodes[ 2 ] ) [ ..] , 500000 ) ;
1295
1299
{
1296
1300
let inflight_htlcs = node_chanmgrs[ 0 ] . compute_inflight_htlcs ( ) ;
1297
1301
@@ -1317,7 +1321,7 @@ fn test_trivial_inflight_htlc_tracking(){
1317
1321
1318
1322
let pending_payments = nodes[ 0 ] . node . list_pending_payments ( ) ;
1319
1323
assert_eq ! ( pending_payments. len( ) , 1 ) ;
1320
- assert_eq ! ( pending_payments[ 0 ] , PendingPaymentDetails :: Retryable { total_msat: 500000 } ) ;
1324
+ assert_eq ! ( pending_payments[ 0 ] , RecentPaymentDetails :: Pending { payment_hash , total_msat: 500000 } ) ;
1321
1325
}
1322
1326
1323
1327
// Now, let's claim the payment. This should result in the used liquidity to return `None`.
0 commit comments