Skip to content

Commit 487a36d

Browse files
committed
Correct and clarify comments in ChannelMonitor loading test utils
1 parent 0670550 commit 487a36d

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

lightning/src/util/test_utils.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -524,8 +524,8 @@ impl<'a> TestChainMonitor<'a> {
524524
blocker.recv().unwrap();
525525
}
526526

527-
// At every point where we get a monitor update, we should be able to send a useful monitor
528-
// to a watchtower and disk...
527+
// Test that a monitor survives a round-trip, and use the round-tripped monitor in the
528+
// underlying `ChainMonitor`.
529529
let mut w = TestVecWriter(Vec::new());
530530
monitor.write(&mut w).unwrap();
531531
let new_monitor = <(BlockHash, ChannelMonitor<TestChannelSigner>)>::read(
@@ -536,7 +536,8 @@ impl<'a> TestChainMonitor<'a> {
536536
.1;
537537
// Note that a ChannelMonitor might not round-trip exactly here as we have tests that were
538538
// serialized prior to LDK 0.1 and re-serializing them will flip the "written after LDK
539-
// 0.1" flag.
539+
// 0.1" flag. Thus, unlike the code in `watch_channel` below, we do not assert that the
540+
// monitor is the same after a serialization round-trip.
540541
self.latest_monitor_update_id
541542
.lock()
542543
.unwrap()
@@ -555,7 +556,8 @@ impl<'a> chain::Watch<TestChannelSigner> for TestChainMonitor<'a> {
555556
}
556557

557558
// At every point where we get a monitor update, we should be able to send a useful monitor
558-
// to a watchtower and disk...
559+
// to a watchtower and disk. At a minimum, this means we should be able to round-trip the
560+
// monitor to a serialized copy and get he same one back.
559561
let mut w = TestVecWriter(Vec::new());
560562
monitor.write(&mut w).unwrap();
561563
let new_monitor = <(BlockHash, ChannelMonitor<TestChannelSigner>)>::read(

0 commit comments

Comments
 (0)