Skip to content

Commit 3b2e8e3

Browse files
committed
Move reload_node fuzz entries into the right position
Since we broke backwards compat and changed the values of bytes for reloading nodes in the `chanmon_consistency` fuzzer, here we move them down to the right position.
1 parent da9273d commit 3b2e8e3

File tree

1 file changed

+61
-61
lines changed

1 file changed

+61
-61
lines changed

fuzz/src/chanmon_consistency.rs

Lines changed: 61 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1514,67 +1514,6 @@ pub fn do_test<Out: Output>(data: &[u8], underlying_out: Out, anchors: bool) {
15141514
0x26 => process_ev_noret!(2, true),
15151515
0x27 => process_ev_noret!(2, false),
15161516

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-
// Note that we ensure 0x2d represents "use oldest monitor" to retain backwards
1553-
// compatibility with existing fuzz corpuses by using setting v % 3 == 0
1554-
let (new_node_b, new_monitor_b) =
1555-
reload_node!(node_b_ser, 1, monitor_b, v, keys_manager_b, fee_est_b);
1556-
nodes[1] = new_node_b;
1557-
monitor_b = new_monitor_b;
1558-
},
1559-
0xbc | 0xbd | 0xbe => {
1560-
// Restart node C, picking among the in-flight `ChannelMonitor`s to use based on
1561-
// the value of `v` we're matching.
1562-
if !chan_b_disconnected {
1563-
nodes[1].peer_disconnected(nodes[2].get_our_node_id());
1564-
chan_b_disconnected = true;
1565-
push_excess_b_events!(
1566-
nodes[1].get_and_clear_pending_msg_events().drain(..),
1567-
Some(2)
1568-
);
1569-
bc_events.clear();
1570-
cb_events.clear();
1571-
}
1572-
let (new_node_c, new_monitor_c) =
1573-
reload_node!(node_c_ser, 2, monitor_c, v, keys_manager_c, fee_est_c);
1574-
nodes[2] = new_node_c;
1575-
monitor_c = new_monitor_c;
1576-
},
1577-
15781517
// 1/10th the channel size:
15791518
0x30 => send_noret(&nodes[0], &nodes[1], chan_a, 10_000_000, &mut p_id, &mut p_idx),
15801519
0x31 => send_noret(&nodes[1], &nodes[0], chan_a, 10_000_000, &mut p_id, &mut p_idx),
@@ -1722,6 +1661,67 @@ pub fn do_test<Out: Output>(data: &[u8], underlying_out: Out, anchors: bool) {
17221661
nodes[2].maybe_propose_quiescence(&nodes[1].get_our_node_id(), &chan_b_id).unwrap()
17231662
},
17241663

1664+
0xb0 | 0xb1 | 0xb2 => {
1665+
// Restart node A, picking among the in-flight `ChannelMonitor`s to use based on
1666+
// the value of `v` we're matching.
1667+
if !chan_a_disconnected {
1668+
nodes[1].peer_disconnected(nodes[0].get_our_node_id());
1669+
chan_a_disconnected = true;
1670+
push_excess_b_events!(
1671+
nodes[1].get_and_clear_pending_msg_events().drain(..),
1672+
Some(0)
1673+
);
1674+
ab_events.clear();
1675+
ba_events.clear();
1676+
}
1677+
let (new_node_a, new_monitor_a) =
1678+
reload_node!(node_a_ser, 0, monitor_a, v, keys_manager_a, fee_est_a);
1679+
nodes[0] = new_node_a;
1680+
monitor_a = new_monitor_a;
1681+
},
1682+
0xb3..=0xbb => {
1683+
// Restart node B, picking among the in-flight `ChannelMonitor`s to use based on
1684+
// the value of `v` we're matching.
1685+
if !chan_a_disconnected {
1686+
nodes[0].peer_disconnected(nodes[1].get_our_node_id());
1687+
chan_a_disconnected = true;
1688+
nodes[0].get_and_clear_pending_msg_events();
1689+
ab_events.clear();
1690+
ba_events.clear();
1691+
}
1692+
if !chan_b_disconnected {
1693+
nodes[2].peer_disconnected(nodes[1].get_our_node_id());
1694+
chan_b_disconnected = true;
1695+
nodes[2].get_and_clear_pending_msg_events();
1696+
bc_events.clear();
1697+
cb_events.clear();
1698+
}
1699+
// Note that we ensure 0x2d represents "use oldest monitor" to retain backwards
1700+
// compatibility with existing fuzz corpuses by using setting v % 3 == 0
1701+
let (new_node_b, new_monitor_b) =
1702+
reload_node!(node_b_ser, 1, monitor_b, v, keys_manager_b, fee_est_b);
1703+
nodes[1] = new_node_b;
1704+
monitor_b = new_monitor_b;
1705+
},
1706+
0xbc | 0xbd | 0xbe => {
1707+
// Restart node C, picking among the in-flight `ChannelMonitor`s to use based on
1708+
// the value of `v` we're matching.
1709+
if !chan_b_disconnected {
1710+
nodes[1].peer_disconnected(nodes[2].get_our_node_id());
1711+
chan_b_disconnected = true;
1712+
push_excess_b_events!(
1713+
nodes[1].get_and_clear_pending_msg_events().drain(..),
1714+
Some(2)
1715+
);
1716+
bc_events.clear();
1717+
cb_events.clear();
1718+
}
1719+
let (new_node_c, new_monitor_c) =
1720+
reload_node!(node_c_ser, 2, monitor_c, v, keys_manager_c, fee_est_c);
1721+
nodes[2] = new_node_c;
1722+
monitor_c = new_monitor_c;
1723+
},
1724+
17251725
0xf0 => complete_monitor_update(&monitor_a, &chan_1_id, &complete_first),
17261726
0xf1 => complete_monitor_update(&monitor_a, &chan_1_id, &complete_second),
17271727
0xf2 => complete_monitor_update(&monitor_a, &chan_1_id, &Vec::pop),

0 commit comments

Comments
 (0)