-
Notifications
You must be signed in to change notification settings - Fork 411
Minor Logging tweaks #2895
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Minor Logging tweaks #2895
Changes from all commits
96b141c
aab5b10
9125de2
8910153
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -726,7 +726,10 @@ impl<ChannelSigner: WriteableEcdsaChannelSigner> OnchainTxHandler<ChannelSigner> | |
B::Target: BroadcasterInterface, | ||
F::Target: FeeEstimator, | ||
{ | ||
log_debug!(logger, "Updating claims view at height {} with {} claim requests", cur_height, requests.len()); | ||
if !requests.is_empty() { | ||
log_debug!(logger, "Updating claims view at height {} with {} claim requests", cur_height, requests.len()); | ||
} | ||
|
||
let mut preprocessed_requests = Vec::with_capacity(requests.len()); | ||
let mut aggregated_request = None; | ||
|
||
|
@@ -772,6 +775,12 @@ impl<ChannelSigner: WriteableEcdsaChannelSigner> OnchainTxHandler<ChannelSigner> | |
|
||
// Claim everything up to and including `cur_height` | ||
let remaining_locked_packages = self.locktimed_packages.split_off(&(cur_height + 1)); | ||
if !self.locktimed_packages.is_empty() { | ||
log_debug!(logger, | ||
"Updating claims view at height {} with {} locked packages available for claim", | ||
cur_height, | ||
self.locktimed_packages.len()); | ||
} | ||
Comment on lines
+778
to
+783
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This debug log could potentially generate a lot of output if there are many locked packages. Evaluate if this level of verbosity is necessary or if it could be condensed or removed. |
||
for (pop_height, mut entry) in self.locktimed_packages.iter_mut() { | ||
log_trace!(logger, "Restoring delayed claim of package(s) at their timelock at {}.", pop_height); | ||
preprocessed_requests.append(&mut entry); | ||
|
@@ -852,8 +861,15 @@ impl<ChannelSigner: WriteableEcdsaChannelSigner> OnchainTxHandler<ChannelSigner> | |
B::Target: BroadcasterInterface, | ||
F::Target: FeeEstimator, | ||
{ | ||
log_debug!(logger, "Updating claims view at height {} with {} matched transactions in block {}", cur_height, txn_matched.len(), conf_height); | ||
let mut have_logged_intro = false; | ||
let mut maybe_log_intro = || { | ||
if !have_logged_intro { | ||
log_debug!(logger, "Updating claims view at height {} with {} matched transactions in block {}", cur_height, txn_matched.len(), conf_height); | ||
have_logged_intro = true; | ||
} | ||
}; | ||
let mut bump_candidates = new_hash_map(); | ||
if !txn_matched.is_empty() { maybe_log_intro(); } | ||
for tx in txn_matched { | ||
// Scan all input to verify is one of the outpoint spent is of interest for us | ||
let mut claimed_outputs_material = Vec::new(); | ||
|
@@ -946,6 +962,7 @@ impl<ChannelSigner: WriteableEcdsaChannelSigner> OnchainTxHandler<ChannelSigner> | |
self.onchain_events_awaiting_threshold_conf.drain(..).collect::<Vec<_>>(); | ||
for entry in onchain_events_awaiting_threshold_conf { | ||
if entry.has_reached_confirmation_threshold(cur_height) { | ||
maybe_log_intro(); | ||
match entry.event { | ||
OnchainEvent::Claim { claim_id } => { | ||
// We may remove a whole set of claim outpoints here, as these one may have | ||
|
@@ -983,7 +1000,11 @@ impl<ChannelSigner: WriteableEcdsaChannelSigner> OnchainTxHandler<ChannelSigner> | |
} | ||
|
||
// Build, bump and rebroadcast tx accordingly | ||
log_trace!(logger, "Bumping {} candidates", bump_candidates.len()); | ||
if !bump_candidates.is_empty() { | ||
maybe_log_intro(); | ||
log_trace!(logger, "Bumping {} candidates", bump_candidates.len()); | ||
} | ||
|
||
Comment on lines
+1003
to
+1007
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Similar to previous comments on logging, ensure that this trace log provides value. If the information is not actionable or does not significantly aid in debugging, consider removing or reducing the verbosity. |
||
for (claim_id, request) in bump_candidates.iter() { | ||
if let Some((new_timer, new_feerate, bump_claim)) = self.generate_claim( | ||
cur_height, &request, &FeerateStrategy::ForceBump, &*fee_estimator, &*logger, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4833,10 +4833,6 @@ where | |
|
||
// If the feerate has decreased by less than half, don't bother | ||
if new_feerate <= chan.context.get_feerate_sat_per_1000_weight() && new_feerate * 2 > chan.context.get_feerate_sat_per_1000_weight() { | ||
if new_feerate != chan.context.get_feerate_sat_per_1000_weight() { | ||
log_trace!(logger, "Channel {} does not qualify for a feerate change from {} to {}.", | ||
chan_id, chan.context.get_feerate_sat_per_1000_weight(), new_feerate); | ||
} | ||
return NotifyOption::SkipPersistNoEvents; | ||
} | ||
if !chan.context.is_live() { | ||
Comment on lines
4833
to
4838
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Consider merging the two if conditions into a single compound condition to improve readability and potentially performance by reducing the number of conditional checks. - if new_feerate <= chan.context.get_feerate_sat_per_1000_weight() && new_feerate * 2 > chan.context.get_feerate_sat_per_1000_weight() {
- return NotifyOption::SkipPersistNoEvents;
- }
- if !chan.context.is_live() {
+ if (new_feerate <= chan.context.get_feerate_sat_per_1000_weight() && new_feerate * 2 > chan.context.get_feerate_sat_per_1000_weight()) || !chan.context.is_live() {
+ return NotifyOption::SkipPersistNoEvents;
+ } |
||
|
Original file line number | Diff line number | Diff line change | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -1925,7 +1925,10 @@ impl<L: Deref> NetworkGraph<L> where L::Target: Logger { | |||||||||||||||||
None => { | ||||||||||||||||||
core::mem::drop(channels); | ||||||||||||||||||
self.pending_checks.check_hold_pending_channel_update(msg, full_msg)?; | ||||||||||||||||||
return Err(LightningError{err: "Couldn't find channel for update".to_owned(), action: ErrorAction::IgnoreError}); | ||||||||||||||||||
return Err(LightningError { | ||||||||||||||||||
err: "Couldn't find channel for update".to_owned(), | ||||||||||||||||||
action: ErrorAction::IgnoreAndLog(Level::Gossip), | ||||||||||||||||||
}); | ||||||||||||||||||
Comment on lines
+1928
to
+1931
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The error message "Couldn't find channel for update" could be more descriptive by including the short channel ID in the message. - Err(LightningError{err: "Couldn't find channel for update".to_owned(), action: ErrorAction::IgnoreAndLog(Level::Gossip)})
+ Err(LightningError{err: format!("Couldn't find channel for update: {}", msg.short_channel_id), action: ErrorAction::IgnoreAndLog(Level::Gossip)}) Committable suggestion
Suggested change
|
||||||||||||||||||
}, | ||||||||||||||||||
Some(channel) => { | ||||||||||||||||||
if msg.htlc_maximum_msat > MAX_VALUE_MSAT { | ||||||||||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider removing the debug log if it does not provide significant value. Excessive logging, especially at debug level, can clutter log files without offering substantial insights.