Skip to content

Commit 5a1eaed

Browse files
committed
f rename to pending_monitors
1 parent 63cc5f6 commit 5a1eaed

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

fuzz/src/chanmon_consistency.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ struct LatestMonitorState {
156156
persisted_monitor: Vec<u8>,
157157
/// A set of (monitor id, serialized `ChannelMonitor`)s which we're currently "persisting",
158158
/// from LDK's perspective.
159-
pending_monitor_updates: Vec<(u64, Vec<u8>)>,
159+
pending_monitors: Vec<(u64, Vec<u8>)>,
160160
}
161161

162162
struct TestChainMonitor {
@@ -187,7 +187,7 @@ impl chain::Watch<TestChannelSigner> for TestChainMonitor {
187187
Ok(chain::ChannelMonitorUpdateStatus::Completed) => {
188188
LatestMonitorState {
189189
persisted_monitor_id: monitor_id, persisted_monitor: ser.0,
190-
pending_monitor_updates: Vec::new(),
190+
pending_monitors: Vec::new(),
191191
}
192192
},
193193
Ok(chain::ChannelMonitorUpdateStatus::InProgress) =>
@@ -204,7 +204,7 @@ impl chain::Watch<TestChannelSigner> for TestChainMonitor {
204204
fn update_channel(&self, funding_txo: OutPoint, update: &channelmonitor::ChannelMonitorUpdate) -> chain::ChannelMonitorUpdateStatus {
205205
let mut map_lock = self.latest_monitors.lock().unwrap();
206206
let map_entry = map_lock.get_mut(&funding_txo).expect("Didn't have monitor on update call");
207-
let latest_monitor_data = map_entry.pending_monitor_updates.last().as_ref().map(|(_, data)| data).unwrap_or(&map_entry.persisted_monitor);
207+
let latest_monitor_data = map_entry.pending_monitors.last().as_ref().map(|(_, data)| data).unwrap_or(&map_entry.persisted_monitor);
208208
let deserialized_monitor = <(BlockHash, channelmonitor::ChannelMonitor<TestChannelSigner>)>::
209209
read(&mut Cursor::new(&latest_monitor_data), (&*self.keys, &*self.keys)).unwrap().1;
210210
deserialized_monitor.update_monitor(update, &&TestBroadcaster{}, &&FuzzEstimator { ret_val: atomic::AtomicU32::new(253) }, &self.logger).unwrap();
@@ -217,7 +217,7 @@ impl chain::Watch<TestChannelSigner> for TestChainMonitor {
217217
map_entry.persisted_monitor = ser.0;
218218
},
219219
chain::ChannelMonitorUpdateStatus::InProgress => {
220-
map_entry.pending_monitor_updates.push((update.update_id, ser.0));
220+
map_entry.pending_monitors.push((update.update_id, ser.0));
221221
},
222222
chain::ChannelMonitorUpdateStatus::UnrecoverableError => panic!(),
223223
}
@@ -555,7 +555,7 @@ pub fn do_test<Out: Output>(data: &[u8], underlying_out: Out, anchors: bool) {
555555
// Wipe any `ChannelMonitor`s which we never told LDK we finished persisting,
556556
// considering them discarded. LDK should replay these for us as they're stored in
557557
// the `ChannelManager`.
558-
prev_state.pending_monitor_updates.clear();
558+
prev_state.pending_monitors.clear();
559559
chain_monitor.latest_monitors.lock().unwrap().insert(outpoint, prev_state);
560560
}
561561
let mut monitor_refs = new_hash_map();
@@ -1091,10 +1091,10 @@ pub fn do_test<Out: Output>(data: &[u8], underlying_out: Out, anchors: bool) {
10911091
| {
10921092
if let Some(state) = monitor.latest_monitors.lock().unwrap().get_mut(chan_funding) {
10931093
assert!(
1094-
state.pending_monitor_updates.windows(2).all(|pair| pair[0].0 < pair[1].0),
1094+
state.pending_monitors.windows(2).all(|pair| pair[0].0 < pair[1].0),
10951095
"updates should be sorted by id"
10961096
);
1097-
if let Some((id, data)) = compl_selector(&mut state.pending_monitor_updates) {
1097+
if let Some((id, data)) = compl_selector(&mut state.pendings) {
10981098
monitor.chain_monitor.channel_monitor_updated(*chan_funding, id).unwrap();
10991099
if id > state.persisted_monitor_id {
11001100
state.persisted_monitor_id = id;
@@ -1107,10 +1107,10 @@ pub fn do_test<Out: Output>(data: &[u8], underlying_out: Out, anchors: bool) {
11071107
let complete_all_monitor_updates = |monitor: &Arc<TestChainMonitor>, chan_funding| {
11081108
if let Some(state) = monitor.latest_monitors.lock().unwrap().get_mut(chan_funding) {
11091109
assert!(
1110-
state.pending_monitor_updates.windows(2).all(|pair| pair[0].0 < pair[1].0),
1110+
state.pending_monitors.windows(2).all(|pair| pair[0].0 < pair[1].0),
11111111
"updates should be sorted by id"
11121112
);
1113-
for (id, data) in state.pending_monitor_updates.drain(..) {
1113+
for (id, data) in state.pending_monitors.drain(..) {
11141114
monitor.chain_monitor.channel_monitor_updated(*chan_funding, id).unwrap();
11151115
if id > state.persisted_monitor_id {
11161116
state.persisted_monitor_id = id;

0 commit comments

Comments
 (0)