10
10
//! Tests that test the payment retry logic in ChannelManager, including various edge-cases around
11
11
//! serialization ordering between ChannelManager/ChannelMonitors and ensuring we can still retry
12
12
//! payments thereafter.
13
-
14
13
use crate :: chain:: channelmonitor:: {
15
14
ANTI_REORG_DELAY , HTLC_FAIL_BACK_BUFFER , LATENCY_GRACE_PERIOD_BLOCKS ,
16
15
} ;
@@ -47,7 +46,7 @@ use crate::types::payment::{PaymentHash, PaymentPreimage, PaymentSecret};
47
46
use crate :: util:: errors:: APIError ;
48
47
use crate :: util:: ser:: Writeable ;
49
48
use crate :: util:: string:: UntrustedString ;
50
- use crate :: util:: test_utils;
49
+ use crate :: util:: { test_utils} ;
51
50
52
51
use bitcoin:: hashes:: sha256:: Hash as Sha256 ;
53
52
use bitcoin:: hashes:: Hash ;
@@ -493,15 +492,15 @@ fn test_mpp_keysend() {
493
492
let nodes = create_network ( 4 , & node_cfgs, & node_chanmgrs) ;
494
493
495
494
let node_b_id = nodes[ 1 ] . node . get_our_node_id ( ) ;
496
- let node_c_id = nodes[ 2 ] . node . get_our_node_id ( ) ;
495
+ // let node_c_id = nodes[2].node.get_our_node_id();
497
496
let node_d_id = nodes[ 3 ] . node . get_our_node_id ( ) ;
498
497
499
498
create_announced_chan_between_nodes ( & nodes, 0 , 1 ) ;
500
- create_announced_chan_between_nodes ( & nodes, 0 , 2 ) ;
499
+ // create_announced_chan_between_nodes(&nodes, 0, 2);
501
500
create_announced_chan_between_nodes ( & nodes, 1 , 3 ) ;
502
- create_announced_chan_between_nodes ( & nodes, 2 , 3 ) ;
501
+ // create_announced_chan_between_nodes(&nodes, 2, 3);
503
502
504
- let recv_value = 15_000_000 ;
503
+ let recv_value = 5_000_000 ;
505
504
let route_params = RouteParameters :: from_payment_params_and_value (
506
505
PaymentParameters :: for_keysend ( node_d_id, 40 , true ) ,
507
506
recv_value,
@@ -514,18 +513,18 @@ fn test_mpp_keysend() {
514
513
let id = PaymentId ( [ 42 ; 32 ] ) ;
515
514
let hash =
516
515
nodes[ 0 ] . node . send_spontaneous_payment ( preimage, onion, id, route_params, retry) . unwrap ( ) ;
517
- check_added_monitors ! ( nodes[ 0 ] , 2 ) ;
516
+ check_added_monitors ! ( nodes[ 0 ] , 1 ) ;
518
517
519
- let route: & [ & [ & Node ] ] = & [ & [ & nodes[ 1 ] , & nodes[ 3 ] ] , & [ & nodes [ 2 ] , & nodes [ 3 ] ] ] ;
518
+ let route: & [ & [ & Node ] ] = & [ & [ & nodes[ 1 ] , & nodes[ 3 ] ] ] ;
520
519
let mut events = nodes[ 0 ] . node . get_and_clear_pending_msg_events ( ) ;
521
- assert_eq ! ( events. len( ) , 2 ) ;
520
+ assert_eq ! ( events. len( ) , 1 ) ;
522
521
523
522
let ev = remove_first_msg_event_to_node ( & node_b_id, & mut events) ;
524
523
let payment_secret = Some ( payment_secret) ;
525
- pass_along_path ( & nodes[ 0 ] , route[ 0 ] , recv_value, hash, payment_secret, ev, false , preimage) ;
524
+ pass_along_path ( & nodes[ 0 ] , route[ 0 ] , recv_value, hash, payment_secret, ev, true , preimage) ;
525
+
526
+ std:: thread:: sleep ( Duration :: from_millis ( 50 ) ) ;
526
527
527
- let ev = remove_first_msg_event_to_node ( & node_c_id, & mut events) ;
528
- pass_along_path ( & nodes[ 0 ] , route[ 1 ] , recv_value, hash, payment_secret, ev, true , preimage) ;
529
528
claim_payment_along_route ( ClaimAlongRouteArgs :: new ( & nodes[ 0 ] , route, preimage. unwrap ( ) ) ) ;
530
529
}
531
530
0 commit comments