@@ -3951,14 +3951,15 @@ fn test_single_channel_multiple_mpp() {
3951
3951
let thrd3 = std:: thread:: spawn ( move || {
3952
3952
std:: thread:: sleep ( MAX_THREAD_INIT_TIME ) ;
3953
3953
do_a_write_background. send ( ( ) ) . unwrap ( ) ;
3954
+ std:: thread:: sleep ( MAX_THREAD_INIT_TIME ) ;
3955
+ do_a_write_background. send ( ( ) ) . unwrap ( ) ;
3954
3956
} ) ;
3955
3957
nodes[ 6 ] . node . handle_revoke_and_ack ( node_5_id, & raa) ;
3956
3958
thrd3. join ( ) . unwrap ( ) ;
3957
3959
3958
3960
let thrd4 = std:: thread:: spawn ( move || {
3959
3961
std:: thread:: sleep ( MAX_THREAD_INIT_TIME ) ;
3960
3962
do_a_write. send ( ( ) ) . unwrap ( ) ;
3961
- do_a_write. send ( ( ) ) . unwrap ( ) ;
3962
3963
} ) ;
3963
3964
3964
3965
thrd4. join ( ) . unwrap ( ) ;
@@ -3978,11 +3979,19 @@ fn test_single_channel_multiple_mpp() {
3978
3979
let ( updates, raa) = get_updates_and_revoke ( & nodes[ 6 ] , & nodes[ 5 ] . node . get_our_node_id ( ) ) ;
3979
3980
nodes[ 5 ] . node . handle_update_fulfill_htlc ( node_6_id, & updates. update_fulfill_htlcs [ 0 ] ) ;
3980
3981
expect_payment_forwarded ! ( nodes[ 5 ] , nodes[ 2 ] , nodes[ 6 ] , Some ( 1000 ) , false , false ) ;
3981
- nodes[ 5 ] . node . handle_update_fulfill_htlc ( node_6_id, & updates. update_fulfill_htlcs [ 1 ] ) ;
3982
- expect_payment_forwarded ! ( nodes[ 5 ] , nodes[ 3 ] , nodes[ 6 ] , Some ( 1000 ) , false , false ) ;
3982
+ let mut next_from = 3 ;
3983
+ if let Some ( update) = updates. update_fulfill_htlcs . get ( 1 ) {
3984
+ nodes[ 5 ] . node . handle_update_fulfill_htlc ( node_6_id, update) ;
3985
+ expect_payment_forwarded ! ( nodes[ 5 ] , nodes[ next_from] , nodes[ 6 ] , Some ( 1000 ) , false , false ) ;
3986
+ next_from += 1 ;
3987
+ }
3983
3988
nodes[ 5 ] . node . handle_commitment_signed ( node_6_id, & updates. commitment_signed ) ;
3984
3989
nodes[ 5 ] . node . handle_revoke_and_ack ( node_6_id, & raa) ;
3985
- check_added_monitors ( & nodes[ 5 ] , 4 ) ;
3990
+ if updates. update_fulfill_htlcs . get ( 1 ) . is_some ( ) {
3991
+ check_added_monitors ( & nodes[ 5 ] , 4 ) ;
3992
+ } else {
3993
+ check_added_monitors ( & nodes[ 5 ] , 3 ) ;
3994
+ }
3986
3995
3987
3996
let ( raa, cs) = get_revoke_commit_msgs ( & nodes[ 5 ] , & node_6_id) ;
3988
3997
@@ -3992,10 +4001,19 @@ fn test_single_channel_multiple_mpp() {
3992
4001
3993
4002
let ( updates, raa) = get_updates_and_revoke ( & nodes[ 6 ] , & nodes[ 5 ] . node . get_our_node_id ( ) ) ;
3994
4003
nodes[ 5 ] . node . handle_update_fulfill_htlc ( node_6_id, & updates. update_fulfill_htlcs [ 0 ] ) ;
3995
- expect_payment_forwarded ! ( nodes[ 5 ] , nodes[ 4 ] , nodes[ 6 ] , Some ( 1000 ) , false , false ) ;
4004
+ expect_payment_forwarded ! ( nodes[ 5 ] , nodes[ next_from] , nodes[ 6 ] , Some ( 1000 ) , false , false ) ;
4005
+ next_from += 1 ;
4006
+ if let Some ( update) = updates. update_fulfill_htlcs . get ( 1 ) {
4007
+ nodes[ 5 ] . node . handle_update_fulfill_htlc ( node_6_id, update) ;
4008
+ expect_payment_forwarded ! ( nodes[ 5 ] , nodes[ next_from] , nodes[ 6 ] , Some ( 1000 ) , false , false ) ;
4009
+ }
3996
4010
nodes[ 5 ] . node . handle_commitment_signed ( node_6_id, & updates. commitment_signed ) ;
3997
4011
nodes[ 5 ] . node . handle_revoke_and_ack ( node_6_id, & raa) ;
3998
- check_added_monitors ( & nodes[ 5 ] , 3 ) ;
4012
+ if updates. update_fulfill_htlcs . get ( 1 ) . is_some ( ) {
4013
+ check_added_monitors ( & nodes[ 5 ] , 4 ) ;
4014
+ } else {
4015
+ check_added_monitors ( & nodes[ 5 ] , 3 ) ;
4016
+ }
3999
4017
4000
4018
let ( raa, cs) = get_revoke_commit_msgs ( & nodes[ 5 ] , & node_6_id) ;
4001
4019
nodes[ 6 ] . node . handle_revoke_and_ack ( node_5_id, & raa) ;
0 commit comments