Skip to content

Commit 6bf2352

Browse files
committed
Bypass channel monitor sync requests when no partition key given
1 parent 790ffa3 commit 6bf2352

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

lightning/src/chain/chainmonitor.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -555,7 +555,7 @@ where
555555
channel_id_bytes[2],
556556
channel_id_bytes[3],
557557
]);
558-
channel_id_u32.wrapping_add(best_height.unwrap_or_default())
558+
best_height.map(|height| channel_id_u32.wrapping_add(height))
559559
};
560560

561561
let partition_factor = if channel_count < 15 {
@@ -565,7 +565,7 @@ where
565565
};
566566

567567
let has_pending_claims = monitor_state.monitor.has_pending_claims();
568-
if has_pending_claims || get_partition_key(channel_id) % partition_factor == 0 {
568+
if has_pending_claims || get_partition_key(channel_id).is_some_and(|key| key % partition_factor == 0) {
569569
log_trace!(logger, "Syncing Channel Monitor");
570570
// Even though we don't track monitor updates from chain-sync as pending, we still want
571571
// updates per-channel to be well-ordered so that users don't see a

0 commit comments

Comments
 (0)