From: Matt Corallo Date: Wed, 21 Apr 2021 02:37:02 +0000 (+0000) Subject: [fuzz] Handle monitor updates during get_and_clear_pending_msg_events X-Git-Tag: v0.0.98~20^2~5 X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=commitdiff_plain;h=8acdbaf2a450e93d77defde9164116079f8cb9e7;p=rust-lightning [fuzz] Handle monitor updates during get_and_clear_pending_msg_events Because we may now generate a monitor update during get_and_clear_pending_msg_events calls, we need to ensure we re-serialize the relevant ChannelManager before attempting to reload it, if such a monitor update occurred. --- diff --git a/fuzz/src/chanmon_consistency.rs b/fuzz/src/chanmon_consistency.rs index d28481123..b564e556d 100644 --- a/fuzz/src/chanmon_consistency.rs +++ b/fuzz/src/chanmon_consistency.rs @@ -800,6 +800,10 @@ pub fn do_test(data: &[u8], out: Out) { chan_a_disconnected = true; drain_msg_events_on_disconnect!(0); } + if monitor_a.should_update_manager.load(atomic::Ordering::Relaxed) { + node_a_ser.0.clear(); + nodes[0].write(&mut node_a_ser).unwrap(); + } let (new_node_a, new_monitor_a) = reload_node!(node_a_ser, 0, monitor_a, keys_manager_a); nodes[0] = new_node_a; monitor_a = new_monitor_a; @@ -827,6 +831,10 @@ pub fn do_test(data: &[u8], out: Out) { chan_b_disconnected = true; drain_msg_events_on_disconnect!(2); } + if monitor_c.should_update_manager.load(atomic::Ordering::Relaxed) { + node_c_ser.0.clear(); + nodes[2].write(&mut node_c_ser).unwrap(); + } let (new_node_c, new_monitor_c) = reload_node!(node_c_ser, 2, monitor_c, keys_manager_c); nodes[2] = new_node_c; monitor_c = new_monitor_c;