Skip to content

Commit 3eec5d3

Browse files
Merge pull request #2820 from TheBlueMatt/2024-01-fuzz-ooo-monitor-updates
Test individual monitor update compl in chanmon_consistency fuzzer
2 parents 9d803a9 + 757cf8f commit 3eec5d3

File tree

1 file changed

+88
-0
lines changed

1 file changed

+88
-0
lines changed

fuzz/src/chanmon_consistency.rs

+88
Original file line numberDiff line numberDiff line change
@@ -1289,6 +1289,94 @@ pub fn do_test<Out: Output>(data: &[u8], underlying_out: Out, anchors: bool) {
12891289
},
12901290
0x89 => { fee_est_c.ret_val.store(253, atomic::Ordering::Release); nodes[2].maybe_update_chan_fees(); },
12911291

1292+
0xf0 => {
1293+
let pending_updates = monitor_a.chain_monitor.list_pending_monitor_updates().remove(&chan_1_funding).unwrap();
1294+
if let Some(id) = pending_updates.get(0) {
1295+
monitor_a.chain_monitor.channel_monitor_updated(chan_1_funding, *id).unwrap();
1296+
}
1297+
nodes[0].process_monitor_events();
1298+
}
1299+
0xf1 => {
1300+
let pending_updates = monitor_a.chain_monitor.list_pending_monitor_updates().remove(&chan_1_funding).unwrap();
1301+
if let Some(id) = pending_updates.get(1) {
1302+
monitor_a.chain_monitor.channel_monitor_updated(chan_1_funding, *id).unwrap();
1303+
}
1304+
nodes[0].process_monitor_events();
1305+
}
1306+
0xf2 => {
1307+
let pending_updates = monitor_a.chain_monitor.list_pending_monitor_updates().remove(&chan_1_funding).unwrap();
1308+
if let Some(id) = pending_updates.last() {
1309+
monitor_a.chain_monitor.channel_monitor_updated(chan_1_funding, *id).unwrap();
1310+
}
1311+
nodes[0].process_monitor_events();
1312+
}
1313+
1314+
0xf4 => {
1315+
let pending_updates = monitor_b.chain_monitor.list_pending_monitor_updates().remove(&chan_1_funding).unwrap();
1316+
if let Some(id) = pending_updates.get(0) {
1317+
monitor_b.chain_monitor.channel_monitor_updated(chan_1_funding, *id).unwrap();
1318+
}
1319+
nodes[1].process_monitor_events();
1320+
}
1321+
0xf5 => {
1322+
let pending_updates = monitor_b.chain_monitor.list_pending_monitor_updates().remove(&chan_1_funding).unwrap();
1323+
if let Some(id) = pending_updates.get(1) {
1324+
monitor_b.chain_monitor.channel_monitor_updated(chan_1_funding, *id).unwrap();
1325+
}
1326+
nodes[1].process_monitor_events();
1327+
}
1328+
0xf6 => {
1329+
let pending_updates = monitor_b.chain_monitor.list_pending_monitor_updates().remove(&chan_1_funding).unwrap();
1330+
if let Some(id) = pending_updates.last() {
1331+
monitor_b.chain_monitor.channel_monitor_updated(chan_1_funding, *id).unwrap();
1332+
}
1333+
nodes[1].process_monitor_events();
1334+
}
1335+
1336+
0xf8 => {
1337+
let pending_updates = monitor_b.chain_monitor.list_pending_monitor_updates().remove(&chan_2_funding).unwrap();
1338+
if let Some(id) = pending_updates.get(0) {
1339+
monitor_b.chain_monitor.channel_monitor_updated(chan_2_funding, *id).unwrap();
1340+
}
1341+
nodes[1].process_monitor_events();
1342+
}
1343+
0xf9 => {
1344+
let pending_updates = monitor_b.chain_monitor.list_pending_monitor_updates().remove(&chan_2_funding).unwrap();
1345+
if let Some(id) = pending_updates.get(1) {
1346+
monitor_b.chain_monitor.channel_monitor_updated(chan_2_funding, *id).unwrap();
1347+
}
1348+
nodes[1].process_monitor_events();
1349+
}
1350+
0xfa => {
1351+
let pending_updates = monitor_b.chain_monitor.list_pending_monitor_updates().remove(&chan_2_funding).unwrap();
1352+
if let Some(id) = pending_updates.last() {
1353+
monitor_b.chain_monitor.channel_monitor_updated(chan_2_funding, *id).unwrap();
1354+
}
1355+
nodes[1].process_monitor_events();
1356+
}
1357+
1358+
0xfc => {
1359+
let pending_updates = monitor_c.chain_monitor.list_pending_monitor_updates().remove(&chan_2_funding).unwrap();
1360+
if let Some(id) = pending_updates.get(0) {
1361+
monitor_c.chain_monitor.channel_monitor_updated(chan_2_funding, *id).unwrap();
1362+
}
1363+
nodes[2].process_monitor_events();
1364+
}
1365+
0xfd => {
1366+
let pending_updates = monitor_c.chain_monitor.list_pending_monitor_updates().remove(&chan_2_funding).unwrap();
1367+
if let Some(id) = pending_updates.get(1) {
1368+
monitor_c.chain_monitor.channel_monitor_updated(chan_2_funding, *id).unwrap();
1369+
}
1370+
nodes[2].process_monitor_events();
1371+
}
1372+
0xfe => {
1373+
let pending_updates = monitor_c.chain_monitor.list_pending_monitor_updates().remove(&chan_2_funding).unwrap();
1374+
if let Some(id) = pending_updates.last() {
1375+
monitor_c.chain_monitor.channel_monitor_updated(chan_2_funding, *id).unwrap();
1376+
}
1377+
nodes[2].process_monitor_events();
1378+
}
1379+
12921380
0xff => {
12931381
// Test that no channel is in a stuck state where neither party can send funds even
12941382
// after we resolve all pending events.

0 commit comments

Comments
 (0)