Skip to content

Commit ba42f76

Browse files
committed
f improve comment clarity and correctness
1 parent 0e590cb commit ba42f76

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

lightning/src/routing/network_graph.rs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -374,13 +374,18 @@ impl<C: Deref , L: Deref > RoutingMessageHandler for NetGraphMsgHandler<C, L> wh
374374
let mut pending_events = self.pending_events.lock().unwrap();
375375
let batch_count = batches.len();
376376
for (batch_index, batch) in batches.into_iter().enumerate() {
377-
// Per spec, the initial first_blocknum needs to be <= the query's first_blocknum and subsequent
378-
// must be >= the prior reply. We'll simplify this by using the query's first_blocknum since its
379-
// still spec compliant and sequence completion is now explicit.
377+
// Per spec, the initial `first_blocknum` needs to be <= the query's `first_blocknum`
378+
// and subsequent `first_blocknum`s must be >= the prior reply's `first_blocknum`.
379+
// We'll simplify this by using the query's first_blocknum since its still spec
380+
// compliant and sequence completion is now explicit.
380381
let first_blocknum = msg.first_blocknum;
381382

382-
// Per spec, the last end_block needs to be >= the query's end_blocknum. Last
383-
// reply calculates difference between the query's end_blocknum and the start of the reply.
383+
// Per spec, the last end_block needs to be >= the query's end_blocknum.
384+
// Each message carries the number of blocks its contents fit in, though there is no
385+
// requirement that we use exactly the number of blocks its contents are from.
386+
//
387+
// For the last reply, we calculate the difference between the query's end_blocknum and
388+
// the start of the reply.
384389
// Overflow safe since end_blocknum must be >= msg.first_block_num.
385390
let number_of_blocks = if batch_index == batch_count-1 {
386391
msg.end_blocknum() - first_blocknum

0 commit comments

Comments
 (0)