Merge pull request #2820 from TheBlueMatt/2024-01-fuzz-ooo-monitor-updates
authorvalentinewallace <valentinewallace@users.noreply.github.com>
Thu, 11 Jan 2024 16:22:34 +0000 (11:22 -0500)
committerGitHub <noreply@github.com>
Thu, 11 Jan 2024 16:22:34 +0000 (11:22 -0500)
Test individual monitor update compl in chanmon_consistency fuzzer

1  2 
fuzz/src/chanmon_consistency.rs

index 81bf9f4415423b4ba074fa796f3c8a17346e28d9,7d8f373096f73012eebe8cd1e903cccb1b96077d..89ff07fe698268a9f8fff51f1b298c124b46e73b
@@@ -48,7 -48,7 +48,7 @@@ use lightning::ln::script::ShutdownScri
  use lightning::ln::functional_test_utils::*;
  use lightning::offers::invoice::{BlindedPayInfo, UnsignedBolt12Invoice};
  use lightning::offers::invoice_request::UnsignedInvoiceRequest;
 -use lightning::onion_message::{Destination, MessageRouter, OnionMessagePath};
 +use lightning::onion_message::messenger::{Destination, MessageRouter, OnionMessagePath};
  use lightning::util::test_channel_signer::{TestChannelSigner, EnforcementState};
  use lightning::util::errors::APIError;
  use lightning::util::logger::Logger;
@@@ -1289,6 -1289,94 +1289,94 @@@ pub fn do_test<Out: Output>(data: &[u8]
                        },
                        0x89 => { fee_est_c.ret_val.store(253, atomic::Ordering::Release); nodes[2].maybe_update_chan_fees(); },
  
+                       0xf0 => {
+                               let pending_updates = monitor_a.chain_monitor.list_pending_monitor_updates().remove(&chan_1_funding).unwrap();
+                               if let Some(id) = pending_updates.get(0) {
+                                       monitor_a.chain_monitor.channel_monitor_updated(chan_1_funding, *id).unwrap();
+                               }
+                               nodes[0].process_monitor_events();
+                       }
+                       0xf1 => {
+                               let pending_updates = monitor_a.chain_monitor.list_pending_monitor_updates().remove(&chan_1_funding).unwrap();
+                               if let Some(id) = pending_updates.get(1) {
+                                       monitor_a.chain_monitor.channel_monitor_updated(chan_1_funding, *id).unwrap();
+                               }
+                               nodes[0].process_monitor_events();
+                       }
+                       0xf2 => {
+                               let pending_updates = monitor_a.chain_monitor.list_pending_monitor_updates().remove(&chan_1_funding).unwrap();
+                               if let Some(id) = pending_updates.last() {
+                                       monitor_a.chain_monitor.channel_monitor_updated(chan_1_funding, *id).unwrap();
+                               }
+                               nodes[0].process_monitor_events();
+                       }
+                       0xf4 => {
+                               let pending_updates = monitor_b.chain_monitor.list_pending_monitor_updates().remove(&chan_1_funding).unwrap();
+                               if let Some(id) = pending_updates.get(0) {
+                                       monitor_b.chain_monitor.channel_monitor_updated(chan_1_funding, *id).unwrap();
+                               }
+                               nodes[1].process_monitor_events();
+                       }
+                       0xf5 => {
+                               let pending_updates = monitor_b.chain_monitor.list_pending_monitor_updates().remove(&chan_1_funding).unwrap();
+                               if let Some(id) = pending_updates.get(1) {
+                                       monitor_b.chain_monitor.channel_monitor_updated(chan_1_funding, *id).unwrap();
+                               }
+                               nodes[1].process_monitor_events();
+                       }
+                       0xf6 => {
+                               let pending_updates = monitor_b.chain_monitor.list_pending_monitor_updates().remove(&chan_1_funding).unwrap();
+                               if let Some(id) = pending_updates.last() {
+                                       monitor_b.chain_monitor.channel_monitor_updated(chan_1_funding, *id).unwrap();
+                               }
+                               nodes[1].process_monitor_events();
+                       }
+                       0xf8 => {
+                               let pending_updates = monitor_b.chain_monitor.list_pending_monitor_updates().remove(&chan_2_funding).unwrap();
+                               if let Some(id) = pending_updates.get(0) {
+                                       monitor_b.chain_monitor.channel_monitor_updated(chan_2_funding, *id).unwrap();
+                               }
+                               nodes[1].process_monitor_events();
+                       }
+                       0xf9 => {
+                               let pending_updates = monitor_b.chain_monitor.list_pending_monitor_updates().remove(&chan_2_funding).unwrap();
+                               if let Some(id) = pending_updates.get(1) {
+                                       monitor_b.chain_monitor.channel_monitor_updated(chan_2_funding, *id).unwrap();
+                               }
+                               nodes[1].process_monitor_events();
+                       }
+                       0xfa => {
+                               let pending_updates = monitor_b.chain_monitor.list_pending_monitor_updates().remove(&chan_2_funding).unwrap();
+                               if let Some(id) = pending_updates.last() {
+                                       monitor_b.chain_monitor.channel_monitor_updated(chan_2_funding, *id).unwrap();
+                               }
+                               nodes[1].process_monitor_events();
+                       }
+                       0xfc => {
+                               let pending_updates = monitor_c.chain_monitor.list_pending_monitor_updates().remove(&chan_2_funding).unwrap();
+                               if let Some(id) = pending_updates.get(0) {
+                                       monitor_c.chain_monitor.channel_monitor_updated(chan_2_funding, *id).unwrap();
+                               }
+                               nodes[2].process_monitor_events();
+                       }
+                       0xfd => {
+                               let pending_updates = monitor_c.chain_monitor.list_pending_monitor_updates().remove(&chan_2_funding).unwrap();
+                               if let Some(id) = pending_updates.get(1) {
+                                       monitor_c.chain_monitor.channel_monitor_updated(chan_2_funding, *id).unwrap();
+                               }
+                               nodes[2].process_monitor_events();
+                       }
+                       0xfe => {
+                               let pending_updates = monitor_c.chain_monitor.list_pending_monitor_updates().remove(&chan_2_funding).unwrap();
+                               if let Some(id) = pending_updates.last() {
+                                       monitor_c.chain_monitor.channel_monitor_updated(chan_2_funding, *id).unwrap();
+                               }
+                               nodes[2].process_monitor_events();
+                       }
                        0xff => {
                                // Test that no channel is in a stuck state where neither party can send funds even
                                // after we resolve all pending events.