@@ -156,7 +156,7 @@ struct LatestMonitorState {
156
156
persisted_monitor : Vec < u8 > ,
157
157
/// A set of (monitor id, serialized `ChannelMonitor`)s which we're currently "persisting",
158
158
/// from LDK's perspective.
159
- pending_monitor_updates : Vec < ( u64 , Vec < u8 > ) > ,
159
+ pending_monitors : Vec < ( u64 , Vec < u8 > ) > ,
160
160
}
161
161
162
162
struct TestChainMonitor {
@@ -187,7 +187,7 @@ impl chain::Watch<TestChannelSigner> for TestChainMonitor {
187
187
Ok ( chain:: ChannelMonitorUpdateStatus :: Completed ) => {
188
188
LatestMonitorState {
189
189
persisted_monitor_id : monitor_id, persisted_monitor : ser. 0 ,
190
- pending_monitor_updates : Vec :: new ( ) ,
190
+ pending_monitors : Vec :: new ( ) ,
191
191
}
192
192
} ,
193
193
Ok ( chain:: ChannelMonitorUpdateStatus :: InProgress ) =>
@@ -204,7 +204,7 @@ impl chain::Watch<TestChannelSigner> for TestChainMonitor {
204
204
fn update_channel ( & self , funding_txo : OutPoint , update : & channelmonitor:: ChannelMonitorUpdate ) -> chain:: ChannelMonitorUpdateStatus {
205
205
let mut map_lock = self . latest_monitors . lock ( ) . unwrap ( ) ;
206
206
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 ) ;
208
208
let deserialized_monitor = <( BlockHash , channelmonitor:: ChannelMonitor < TestChannelSigner > ) >::
209
209
read ( & mut Cursor :: new ( & latest_monitor_data) , ( & * self . keys , & * self . keys ) ) . unwrap ( ) . 1 ;
210
210
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 {
217
217
map_entry. persisted_monitor = ser. 0 ;
218
218
} ,
219
219
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 ) ) ;
221
221
} ,
222
222
chain:: ChannelMonitorUpdateStatus :: UnrecoverableError => panic ! ( ) ,
223
223
}
@@ -555,7 +555,7 @@ pub fn do_test<Out: Output>(data: &[u8], underlying_out: Out, anchors: bool) {
555
555
// Wipe any `ChannelMonitor`s which we never told LDK we finished persisting,
556
556
// considering them discarded. LDK should replay these for us as they're stored in
557
557
// the `ChannelManager`.
558
- prev_state. pending_monitor_updates . clear( ) ;
558
+ prev_state. pending_monitors . clear( ) ;
559
559
chain_monitor. latest_monitors. lock( ) . unwrap( ) . insert( outpoint, prev_state) ;
560
560
}
561
561
let mut monitor_refs = new_hash_map( ) ;
@@ -1091,10 +1091,10 @@ pub fn do_test<Out: Output>(data: &[u8], underlying_out: Out, anchors: bool) {
1091
1091
| {
1092
1092
if let Some ( state) = monitor. latest_monitors. lock( ) . unwrap( ) . get_mut( chan_funding) {
1093
1093
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 ) ,
1095
1095
"updates should be sorted by id"
1096
1096
) ;
1097
- if let Some ( ( id, data) ) = compl_selector( & mut state. pending_monitor_updates ) {
1097
+ if let Some ( ( id, data) ) = compl_selector( & mut state. pendings ) {
1098
1098
monitor. chain_monitor. channel_monitor_updated( * chan_funding, id) . unwrap( ) ;
1099
1099
if id > state. persisted_monitor_id {
1100
1100
state. persisted_monitor_id = id;
@@ -1107,10 +1107,10 @@ pub fn do_test<Out: Output>(data: &[u8], underlying_out: Out, anchors: bool) {
1107
1107
let complete_all_monitor_updates = |monitor: & Arc < TestChainMonitor > , chan_funding| {
1108
1108
if let Some ( state) = monitor. latest_monitors. lock( ) . unwrap( ) . get_mut( chan_funding) {
1109
1109
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 ) ,
1111
1111
"updates should be sorted by id"
1112
1112
) ;
1113
- for ( id, data) in state. pending_monitor_updates . drain( ..) {
1113
+ for ( id, data) in state. pending_monitors . drain( ..) {
1114
1114
monitor. chain_monitor. channel_monitor_updated( * chan_funding, id) . unwrap( ) ;
1115
1115
if id > state. persisted_monitor_id {
1116
1116
state. persisted_monitor_id = id;
0 commit comments