@@ -718,7 +718,8 @@ pub fn do_test<Out: Output>(data: &[u8], underlying_out: Out, anchors: bool) {
718
718
let old_mon = prev_state. persisted_monitor;
719
719
prev_state. pending_monitors. pop( ) . map( |( _, v) | v) . unwrap_or( old_mon)
720
720
} ;
721
- // Use a different value of `use_old_mons` if we have another monitor (only node B)
721
+ // Use a different value of `use_old_mons` if we have another monitor (only for
722
+ // node B) by shifting `use_old_mons` one in base-3.
722
723
use_old_mons /= 3 ;
723
724
let mon = <( BlockHash , ChannelMonitor <TestChannelSigner >) >:: read(
724
725
& mut & serialized_mon[ ..] ,
@@ -1514,65 +1515,6 @@ pub fn do_test<Out: Output>(data: &[u8], underlying_out: Out, anchors: bool) {
1514
1515
0x26 => process_ev_noret ! ( 2 , true ) ,
1515
1516
0x27 => process_ev_noret ! ( 2 , false ) ,
1516
1517
1517
- 0xb0 | 0xb1 | 0xb2 => {
1518
- // Restart node A, picking among the in-flight `ChannelMonitor`s to use based on
1519
- // the value of `v` we're matching.
1520
- if !chan_a_disconnected {
1521
- nodes[ 1 ] . peer_disconnected ( nodes[ 0 ] . get_our_node_id ( ) ) ;
1522
- chan_a_disconnected = true ;
1523
- push_excess_b_events ! (
1524
- nodes[ 1 ] . get_and_clear_pending_msg_events( ) . drain( ..) ,
1525
- Some ( 0 )
1526
- ) ;
1527
- ab_events. clear ( ) ;
1528
- ba_events. clear ( ) ;
1529
- }
1530
- let ( new_node_a, new_monitor_a) =
1531
- reload_node ! ( node_a_ser, 0 , monitor_a, v, keys_manager_a, fee_est_a) ;
1532
- nodes[ 0 ] = new_node_a;
1533
- monitor_a = new_monitor_a;
1534
- } ,
1535
- 0xb3 ..=0xbb => {
1536
- // Restart node B, picking among the in-flight `ChannelMonitor`s to use based on
1537
- // the value of `v` we're matching.
1538
- if !chan_a_disconnected {
1539
- nodes[ 0 ] . peer_disconnected ( nodes[ 1 ] . get_our_node_id ( ) ) ;
1540
- chan_a_disconnected = true ;
1541
- nodes[ 0 ] . get_and_clear_pending_msg_events ( ) ;
1542
- ab_events. clear ( ) ;
1543
- ba_events. clear ( ) ;
1544
- }
1545
- if !chan_b_disconnected {
1546
- nodes[ 2 ] . peer_disconnected ( nodes[ 1 ] . get_our_node_id ( ) ) ;
1547
- chan_b_disconnected = true ;
1548
- nodes[ 2 ] . get_and_clear_pending_msg_events ( ) ;
1549
- bc_events. clear ( ) ;
1550
- cb_events. clear ( ) ;
1551
- }
1552
- let ( new_node_b, new_monitor_b) =
1553
- reload_node ! ( node_b_ser, 1 , monitor_b, v, keys_manager_b, fee_est_b) ;
1554
- nodes[ 1 ] = new_node_b;
1555
- monitor_b = new_monitor_b;
1556
- } ,
1557
- 0xbc | 0xbd | 0xbe => {
1558
- // Restart node C, picking among the in-flight `ChannelMonitor`s to use based on
1559
- // the value of `v` we're matching.
1560
- if !chan_b_disconnected {
1561
- nodes[ 1 ] . peer_disconnected ( nodes[ 2 ] . get_our_node_id ( ) ) ;
1562
- chan_b_disconnected = true ;
1563
- push_excess_b_events ! (
1564
- nodes[ 1 ] . get_and_clear_pending_msg_events( ) . drain( ..) ,
1565
- Some ( 2 )
1566
- ) ;
1567
- bc_events. clear ( ) ;
1568
- cb_events. clear ( ) ;
1569
- }
1570
- let ( new_node_c, new_monitor_c) =
1571
- reload_node ! ( node_c_ser, 2 , monitor_c, v, keys_manager_c, fee_est_c) ;
1572
- nodes[ 2 ] = new_node_c;
1573
- monitor_c = new_monitor_c;
1574
- } ,
1575
-
1576
1518
// 1/10th the channel size:
1577
1519
0x30 => send_noret ( & nodes[ 0 ] , & nodes[ 1 ] , chan_a, 10_000_000 , & mut p_id, & mut p_idx) ,
1578
1520
0x31 => send_noret ( & nodes[ 1 ] , & nodes[ 0 ] , chan_a, 10_000_000 , & mut p_id, & mut p_idx) ,
@@ -1720,6 +1662,65 @@ pub fn do_test<Out: Output>(data: &[u8], underlying_out: Out, anchors: bool) {
1720
1662
nodes[ 2 ] . maybe_propose_quiescence ( & nodes[ 1 ] . get_our_node_id ( ) , & chan_b_id) . unwrap ( )
1721
1663
} ,
1722
1664
1665
+ 0xb0 | 0xb1 | 0xb2 => {
1666
+ // Restart node A, picking among the in-flight `ChannelMonitor`s to use based on
1667
+ // the value of `v` we're matching.
1668
+ if !chan_a_disconnected {
1669
+ nodes[ 1 ] . peer_disconnected ( nodes[ 0 ] . get_our_node_id ( ) ) ;
1670
+ chan_a_disconnected = true ;
1671
+ push_excess_b_events ! (
1672
+ nodes[ 1 ] . get_and_clear_pending_msg_events( ) . drain( ..) ,
1673
+ Some ( 0 )
1674
+ ) ;
1675
+ ab_events. clear ( ) ;
1676
+ ba_events. clear ( ) ;
1677
+ }
1678
+ let ( new_node_a, new_monitor_a) =
1679
+ reload_node ! ( node_a_ser, 0 , monitor_a, v, keys_manager_a, fee_est_a) ;
1680
+ nodes[ 0 ] = new_node_a;
1681
+ monitor_a = new_monitor_a;
1682
+ } ,
1683
+ 0xb3 ..=0xbb => {
1684
+ // Restart node B, picking among the in-flight `ChannelMonitor`s to use based on
1685
+ // the value of `v` we're matching.
1686
+ if !chan_a_disconnected {
1687
+ nodes[ 0 ] . peer_disconnected ( nodes[ 1 ] . get_our_node_id ( ) ) ;
1688
+ chan_a_disconnected = true ;
1689
+ nodes[ 0 ] . get_and_clear_pending_msg_events ( ) ;
1690
+ ab_events. clear ( ) ;
1691
+ ba_events. clear ( ) ;
1692
+ }
1693
+ if !chan_b_disconnected {
1694
+ nodes[ 2 ] . peer_disconnected ( nodes[ 1 ] . get_our_node_id ( ) ) ;
1695
+ chan_b_disconnected = true ;
1696
+ nodes[ 2 ] . get_and_clear_pending_msg_events ( ) ;
1697
+ bc_events. clear ( ) ;
1698
+ cb_events. clear ( ) ;
1699
+ }
1700
+ let ( new_node_b, new_monitor_b) =
1701
+ reload_node ! ( node_b_ser, 1 , monitor_b, v, keys_manager_b, fee_est_b) ;
1702
+ nodes[ 1 ] = new_node_b;
1703
+ monitor_b = new_monitor_b;
1704
+ } ,
1705
+ 0xbc | 0xbd | 0xbe => {
1706
+ // Restart node C, picking among the in-flight `ChannelMonitor`s to use based on
1707
+ // the value of `v` we're matching.
1708
+ if !chan_b_disconnected {
1709
+ nodes[ 1 ] . peer_disconnected ( nodes[ 2 ] . get_our_node_id ( ) ) ;
1710
+ chan_b_disconnected = true ;
1711
+ push_excess_b_events ! (
1712
+ nodes[ 1 ] . get_and_clear_pending_msg_events( ) . drain( ..) ,
1713
+ Some ( 2 )
1714
+ ) ;
1715
+ bc_events. clear ( ) ;
1716
+ cb_events. clear ( ) ;
1717
+ }
1718
+ let ( new_node_c, new_monitor_c) =
1719
+ reload_node ! ( node_c_ser, 2 , monitor_c, v, keys_manager_c, fee_est_c) ;
1720
+ nodes[ 2 ] = new_node_c;
1721
+ monitor_c = new_monitor_c;
1722
+ } ,
1723
+
1723
1724
0xf0 => complete_monitor_update ( & monitor_a, & chan_1_id, & complete_first) ,
1724
1725
0xf1 => complete_monitor_update ( & monitor_a, & chan_1_id, & complete_second) ,
1725
1726
0xf2 => complete_monitor_update ( & monitor_a, & chan_1_id, & Vec :: pop) ,
0 commit comments