Skip to content

Commit d149aae

Browse files
committed
f drop pairs
1 parent 406bef6 commit d149aae

File tree

1 file changed

+13
-16
lines changed

1 file changed

+13
-16
lines changed

lightning/src/util/persist.rs

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1189,14 +1189,12 @@ mod tests {
11891189
}
11901190

11911191
// Exercise the `MonitorUpdatingPersister` with real channels and payments.
1192-
fn do_persister_with_real_monitors(persisters_max_pending_updates: (u64, u64)) {
1193-
let persister_0_max_pending_updates = persisters_max_pending_updates.0;
1194-
let persister_1_max_pending_updates = persisters_max_pending_updates.1;
1192+
fn do_persister_with_real_monitors(max_pending_updates_0: u64, max_pending_updates_1: u64) {
11951193
let chanmon_cfgs = create_chanmon_cfgs(4);
11961194
let persister_0 = MonitorUpdatingPersister {
11971195
kv_store: &TestStore::new(false),
11981196
logger: &TestLogger::new(),
1199-
maximum_pending_updates: persister_0_max_pending_updates,
1197+
maximum_pending_updates: max_pending_updates_0,
12001198
entropy_source: &chanmon_cfgs[0].keys_manager,
12011199
signer_provider: &chanmon_cfgs[0].keys_manager,
12021200
broadcaster: &chanmon_cfgs[0].tx_broadcaster,
@@ -1205,7 +1203,7 @@ mod tests {
12051203
let persister_1 = MonitorUpdatingPersister {
12061204
kv_store: &TestStore::new(false),
12071205
logger: &TestLogger::new(),
1208-
maximum_pending_updates: persister_1_max_pending_updates,
1206+
maximum_pending_updates: max_pending_updates_1,
12091207
entropy_source: &chanmon_cfgs[1].keys_manager,
12101208
signer_provider: &chanmon_cfgs[1].keys_manager,
12111209
broadcaster: &chanmon_cfgs[1].tx_broadcaster,
@@ -1254,10 +1252,10 @@ mod tests {
12541252
assert_eq!(mon.get_latest_update_id(), $expected_update_id);
12551253

12561254
let monitor_name = mon.persistence_key();
1257-
let expected_updates = if persister_0_max_pending_updates == 0 {
1255+
let expected_updates = if max_pending_updates_0 == 0 {
12581256
0
12591257
} else {
1260-
mon.get_latest_update_id() % persister_0_max_pending_updates
1258+
mon.get_latest_update_id() % max_pending_updates_0
12611259
};
12621260
let update_list = KVStoreSync::list(
12631261
&*persister_0.kv_store,
@@ -1272,10 +1270,10 @@ mod tests {
12721270
for (_, mon) in persisted_chan_data_1.iter() {
12731271
assert_eq!(mon.get_latest_update_id(), $expected_update_id);
12741272
let monitor_name = mon.persistence_key();
1275-
let expected_updates = if persister_1_max_pending_updates == 0 {
1273+
let expected_updates = if max_pending_updates_1 == 0 {
12761274
0
12771275
} else {
1278-
mon.get_latest_update_id() % persister_1_max_pending_updates
1276+
mon.get_latest_update_id() % max_pending_updates_1
12791277
};
12801278
let update_list = KVStoreSync::list(
12811279
&*persister_1.kv_store,
@@ -1300,7 +1298,7 @@ mod tests {
13001298
// Send a few more payments to try all the alignments of max pending updates with
13011299
// updates for a payment sent and received.
13021300
let mut sender = 0;
1303-
for i in 3..=persister_0_max_pending_updates * 2 {
1301+
for i in 3..=max_pending_updates_0 * 2 {
13041302
let receiver;
13051303
if sender == 0 {
13061304
sender = 1;
@@ -1343,18 +1341,17 @@ mod tests {
13431341
check_added_monitors!(nodes[1], 1);
13441342

13451343
// Make sure everything is persisted as expected after close.
1346-
// We always send at least two payments, and loop up to persister_0_max_pending_updates *
1347-
// 2.
1344+
// We always send at least two payments, and loop up to max_pending_updates_0 * 2.
13481345
check_persisted_data!(
1349-
cmp::max(2, persister_0_max_pending_updates * 2) * EXPECTED_UPDATES_PER_PAYMENT + 1
1346+
cmp::max(2, max_pending_updates_0 * 2) * EXPECTED_UPDATES_PER_PAYMENT + 1
13501347
);
13511348
}
13521349

13531350
#[test]
13541351
fn persister_with_real_monitors() {
1355-
do_persister_with_real_monitors((7, 3));
1356-
do_persister_with_real_monitors((0, 1));
1357-
do_persister_with_real_monitors((4, 2));
1352+
do_persister_with_real_monitors(7, 3);
1353+
do_persister_with_real_monitors(0, 1);
1354+
do_persister_with_real_monitors(4, 2);
13581355
}
13591356

13601357
// Test that if the `MonitorUpdatingPersister`'s can't actually write, trying to persist a

0 commit comments

Comments
 (0)