@@ -703,12 +703,13 @@ pub fn do_test<Out: Output>(data: &[u8], underlying_out: Out, anchors: bool) {
703
703
704
704
let mut monitors = new_hash_map( ) ;
705
705
let mut old_monitors = $old_monitors. latest_monitors. lock( ) . unwrap( ) ;
706
+ let mut use_old_mons = $use_old_mons;
706
707
for ( channel_id, mut prev_state) in old_monitors. drain( ) {
707
- let serialized_mon = if $ use_old_mons % 3 == 0 {
708
+ let serialized_mon = if use_old_mons % 3 == 0 {
708
709
// Reload with the oldest `ChannelMonitor` (the one that we already told
709
710
// `ChannelManager` we finished persisting).
710
711
prev_state. persisted_monitor
711
- } else if $ use_old_mons % 3 == 1 {
712
+ } else if use_old_mons % 3 == 1 {
712
713
// Reload with the second-oldest `ChannelMonitor`
713
714
let old_mon = prev_state. persisted_monitor;
714
715
prev_state. pending_monitors. drain( ..) . next( ) . map( |( _, v) | v) . unwrap_or( old_mon)
@@ -717,6 +718,8 @@ pub fn do_test<Out: Output>(data: &[u8], underlying_out: Out, anchors: bool) {
717
718
let old_mon = prev_state. persisted_monitor;
718
719
prev_state. pending_monitors. pop( ) . map( |( _, v) | v) . unwrap_or( old_mon)
719
720
} ;
721
+ // Use a different value of `use_old_mons` if we have another monitor (only node B)
722
+ use_old_mons /= 3 ;
720
723
let mon = <( BlockHash , ChannelMonitor <TestChannelSigner >) >:: read(
721
724
& mut & serialized_mon[ ..] ,
722
725
( & * $keys, & * $keys) ,
@@ -1511,7 +1514,7 @@ pub fn do_test<Out: Output>(data: &[u8], underlying_out: Out, anchors: bool) {
1511
1514
0x26 => process_ev_noret ! ( 2 , true ) ,
1512
1515
0x27 => process_ev_noret ! ( 2 , false ) ,
1513
1516
1514
- 0x2a | 0x2b | 0x2c => {
1517
+ 0xb0 | 0xb1 | 0xb2 => {
1515
1518
// Restart node A, picking among the in-flight `ChannelMonitor`s to use based on
1516
1519
// the value of `v` we're matching.
1517
1520
if !chan_a_disconnected {
@@ -1524,14 +1527,12 @@ pub fn do_test<Out: Output>(data: &[u8], underlying_out: Out, anchors: bool) {
1524
1527
ab_events. clear ( ) ;
1525
1528
ba_events. clear ( ) ;
1526
1529
}
1527
- // Note that we ensure 0x2c represents "use oldest monitor" to retain backwards
1528
- // compatibility with existing fuzz corpuses by using setting (v + 1) % 3 == 0
1529
1530
let ( new_node_a, new_monitor_a) =
1530
- reload_node ! ( node_a_ser, 0 , monitor_a, v + 1 , keys_manager_a, fee_est_a) ;
1531
+ reload_node ! ( node_a_ser, 0 , monitor_a, v, keys_manager_a, fee_est_a) ;
1531
1532
nodes[ 0 ] = new_node_a;
1532
1533
monitor_a = new_monitor_a;
1533
1534
} ,
1534
- 0x28 | 0x29 | 0x2d => {
1535
+ 0xb3 ..= 0xbb => {
1535
1536
// Restart node B, picking among the in-flight `ChannelMonitor`s to use based on
1536
1537
// the value of `v` we're matching.
1537
1538
if !chan_a_disconnected {
@@ -1555,8 +1556,8 @@ pub fn do_test<Out: Output>(data: &[u8], underlying_out: Out, anchors: bool) {
1555
1556
nodes[ 1 ] = new_node_b;
1556
1557
monitor_b = new_monitor_b;
1557
1558
} ,
1558
- 0x2e | 0x2f => {
1559
- // Restart node B , picking among the in-flight `ChannelMonitor`s to use based on
1559
+ 0xbc | 0xbd | 0xbe => {
1560
+ // Restart node C , picking among the in-flight `ChannelMonitor`s to use based on
1560
1561
// the value of `v` we're matching.
1561
1562
if !chan_b_disconnected {
1562
1563
nodes[ 1 ] . peer_disconnected ( nodes[ 2 ] . get_our_node_id ( ) ) ;
@@ -1568,10 +1569,8 @@ pub fn do_test<Out: Output>(data: &[u8], underlying_out: Out, anchors: bool) {
1568
1569
bc_events. clear ( ) ;
1569
1570
cb_events. clear ( ) ;
1570
1571
}
1571
- // Note that we ensure 0x2e represents "use oldest monitor" to retain backwards
1572
- // compatibility with existing fuzz corpuses by using setting (v + 2) % 3 == 0
1573
1572
let ( new_node_c, new_monitor_c) =
1574
- reload_node ! ( node_c_ser, 2 , monitor_c, v + 2 , keys_manager_c, fee_est_c) ;
1573
+ reload_node ! ( node_c_ser, 2 , monitor_c, v, keys_manager_c, fee_est_c) ;
1575
1574
nodes[ 2 ] = new_node_c;
1576
1575
monitor_c = new_monitor_c;
1577
1576
} ,
0 commit comments