Remove redundant channel ID logging
What changed, and why it matters
This commit is a straightforward cleanup of log messages. It removes duplicate channel IDs from the text of log lines when the same ID is already attached as a structured field. There is no change to program logic, network behavior, cryptography, or access control. It only affects what developers and operators see in logs, making them more consistent and easier to read.
No security action required. Treat as a normal code-quality/logging refactor. Reviewers may optionally verify that the structured logging fields still include channel_id where expected, which the commit message says was confirmed by a test run.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The patch removes redundant channel_id interpolations from log macros across chain monitor, channel, channel manager, peer handler, invoice utilities, and related tests. The structured logging context (e.g., WithChannelContext/WithChannelMonitor loggers) already carries the channel_id, so embedding it again in the human-readable message was redundant. The commit also updates a few test assertions and one API error string construction to match the new message format. No functional code paths, state machines, or security boundaries are modified.
Changed components
lightning/src/chain/chainmonitor.rslightning/src/chain/channelmonitor.rslightning/src/ln/chanmon_update_fail_tests.rslightning/src/ln/channel.rslightning/src/ln/channelmanager.rslightning/src/ln/functional_tests.rslightning/src/ln/htlc_reserve_unit_tests.rslightning/src/ln/invoice_utils.rslightning/src/ln/payment_tests.rslightning/src/ln/peer_handler.rsInspect captured patch +198 / −251
diff --git a/lightning/src/chain/chainmonitor.rs b/lightning/src/chain/chainmonitor.rs
index 046e285..995c811 100644
--- a/lightning/src/chain/chainmonitor.rs
+++ b/lightning/src/chain/chainmonitor.rs
@@ -580,11 +580,7 @@ where
let has_pending_claims = monitor_state.monitor.has_pending_claims();
if has_pending_claims || get_partition_key(channel_id) % partition_factor == 0 {
- log_trace!(
- logger,
- "Syncing Channel Monitor for channel {}",
- log_funding_info!(monitor)
- );
+ log_trace!(logger, "Syncing Channel Monitor");
// Even though we don't track monitor updates from chain-sync as pending, we still want
// updates per-channel to be well-ordered so that users don't see a
// `ChannelMonitorUpdate` after a channel persist for a channel with the same
@@ -592,11 +588,9 @@ where
let _pending_monitor_updates = monitor_state.pending_monitor_updates.lock().unwrap();
match self.persister.update_persisted_channel(monitor.persistence_key(), None, monitor)
{
- ChannelMonitorUpdateStatus::Completed => log_trace!(
- logger,
- "Finished syncing Channel Monitor for channel {} for block-data",
- log_funding_info!(monitor)
- ),
+ ChannelMonitorUpdateStatus::Completed => {
+ log_trace!(logger, "Finished syncing Channel Monitor for block-data")
+ },
ChannelMonitorUpdateStatus::InProgress => {
log_trace!(
logger,
@@ -961,16 +955,12 @@ where
}
if have_monitors_to_prune {
let mut monitors = self.monitors.write().unwrap();
- monitors.retain(|channel_id, monitor_holder| {
+ monitors.retain(|_channel_id, monitor_holder| {
let logger = WithChannelMonitor::from(&self.logger, &monitor_holder.monitor, None);
let (is_fully_resolved, _) =
monitor_holder.monitor.check_and_update_full_resolution_status(&logger);
if is_fully_resolved {
- log_info!(
- logger,
- "Archiving fully resolved ChannelMonitor for channel ID {}",
- channel_id
- );
+ log_info!(logger, "Archiving fully resolved ChannelMonitor");
self.persister
.archive_persisted_channel(monitor_holder.monitor.persistence_key());
false
@@ -1106,11 +1096,7 @@ where
},
hash_map::Entry::Vacant(e) => e,
};
- log_trace!(
- logger,
- "Loaded existing ChannelMonitor for channel {}",
- log_funding_info!(monitor)
- );
+ log_trace!(logger, "Loaded existing ChannelMonitor");
if let Some(ref chain_source) = self.chain_source {
monitor.load_outputs_to_watch(chain_source, &self.logger);
}
@@ -1366,25 +1352,17 @@ where
},
hash_map::Entry::Vacant(e) => e,
};
- log_trace!(logger, "Got new ChannelMonitor for channel {}", log_funding_info!(monitor));
+ log_trace!(logger, "Got new ChannelMonitor");
let update_id = monitor.get_latest_update_id();
let mut pending_monitor_updates = Vec::new();
let persist_res = self.persister.persist_new_channel(monitor.persistence_key(), &monitor);
match persist_res {
ChannelMonitorUpdateStatus::InProgress => {
- log_info!(
- logger,
- "Persistence of new ChannelMonitor for channel {} in progress",
- log_funding_info!(monitor)
- );
+ log_info!(logger, "Persistence of new ChannelMonitor in progress",);
pending_monitor_updates.push(update_id);
},
ChannelMonitorUpdateStatus::Completed => {
- log_info!(
- logger,
- "Persistence of new ChannelMonitor for channel {} completed",
- log_funding_info!(monitor)
- );
+ log_info!(logger, "Persistence of new ChannelMonitor completed",);
},
ChannelMonitorUpdateStatus::UnrecoverableError => {
let err_str = "ChannelMonitor[Update] persistence failed unrecoverably. This indicates we cannot continue normal operation and must shut down.";
@@ -1426,12 +1404,7 @@ where
Some(monitor_state) => {
let monitor = &monitor_state.monitor;
let logger = WithChannelMonitor::from(&self.logger, &monitor, None);
- log_trace!(
- logger,
- "Updating ChannelMonitor to id {} for channel {}",
- update.update_id,
- log_funding_info!(monitor)
- );
+ log_trace!(logger, "Updating ChannelMonitor to id {}", update.update_id,);
// We hold a `pending_monitor_updates` lock through `update_monitor` to ensure we
// have well-ordered updates from the users' point of view. See the
@@ -1452,7 +1425,7 @@ where
// We don't want to persist a `monitor_update` which results in a failure to apply later
// while reading `channel_monitor` with updates from storage. Instead, we should persist
// the entire `channel_monitor` here.
- log_warn!(logger, "Failed to update ChannelMonitor for channel {}. Going ahead and persisting the entire ChannelMonitor", log_funding_info!(monitor));
+ log_warn!(logger, "Failed to update ChannelMonitor. Going ahead and persisting the entire ChannelMonitor");
self.persister.update_persisted_channel(
monitor.persistence_key(),
None,
@@ -1468,18 +1441,17 @@ where
match persist_res {
ChannelMonitorUpdateStatus::InProgress => {
pending_monitor_updates.push(update_id);
- log_debug!(logger,
- "Persistence of ChannelMonitorUpdate id {:?} for channel {} in progress",
+ log_debug!(
+ logger,
+ "Persistence of ChannelMonitorUpdate id {:?} in progress",
update_id,
- log_funding_info!(monitor)
);
},
ChannelMonitorUpdateStatus::Completed => {
log_debug!(
logger,
- "Persistence of ChannelMonitorUpdate id {:?} for channel {} completed",
+ "Persistence of ChannelMonitorUpdate id {:?} completed",
update_id,
- log_funding_info!(monitor)
);
},
ChannelMonitorUpdateStatus::UnrecoverableError => {
diff --git a/lightning/src/chain/channelmonitor.rs b/lightning/src/chain/channelmonitor.rs
index 1d035b6..d217f8a 100644
--- a/lightning/src/chain/channelmonitor.rs
+++ b/lightning/src/chain/channelmonitor.rs
@@ -4223,8 +4223,8 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
log_info!(logger, "Applying pre-0.1 force close update to monitor {} with {} change(s).",
log_funding_info!(self), updates.updates.len());
} else {
- log_info!(logger, "Applying update to monitor {}, bringing update_id from {} to {} with {} change(s).",
- log_funding_info!(self), self.latest_update_id, updates.update_id, updates.updates.len());
+ log_info!(logger, "Applying update, bringing update_id from {} to {} with {} change(s).",
+ self.latest_update_id, updates.update_id, updates.updates.len());
}
// ChannelMonitor updates may be applied after force close if we receive a preimage for a
@@ -4351,7 +4351,7 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
self.queue_latest_holder_commitment_txn_for_broadcast(broadcaster, &bounded_fee_estimator, logger, true);
} else if !self.holder_tx_signed {
log_error!(logger, "WARNING: You have a potentially-unsafe holder commitment transaction available to broadcast");
- log_error!(logger, " in channel monitor for channel {}!", &self.channel_id());
+ log_error!(logger, " in channel monitor!");
log_error!(logger, " Read the docs for ChannelMonitor::broadcast_latest_holder_commitment_txn to take manual action!");
} else {
// If we generated a MonitorEvent::HolderForceClosed, the ChannelManager
@@ -5479,7 +5479,7 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
} else {
"".to_string()
};
- log_info!(logger, "{desc} for channel {} confirmed with txid {txid}{action}", self.channel_id());
+ log_info!(logger, "{desc} confirmed with txid {txid}{action}");
self.alternative_funding_confirmed = Some((txid, height));
@@ -5531,8 +5531,7 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
.map(|(txid, _)| txid)
.unwrap_or_else(|| self.funding.funding_txid())
);
- log_info!(logger, "Channel {} closed by funding output spend in txid {txid}",
- self.channel_id());
+ log_info!(logger, "Channel closed by funding output spend in txid {txid}");
if !self.funding_spend_seen {
self.pending_monitor_events.push(MonitorEvent::CommitmentTxConfirmed(()));
}
diff --git a/lightning/src/ln/chanmon_update_fail_tests.rs b/lightning/src/ln/chanmon_update_fail_tests.rs
index 27c29b1..432a45c 100644
--- a/lightning/src/ln/chanmon_update_fail_tests.rs
+++ b/lightning/src/ln/chanmon_update_fail_tests.rs
@@ -150,8 +150,7 @@ fn test_monitor_and_persister_update_fail() {
}
logger.assert_log_regex(
"lightning::chain::chainmonitor",
- regex::Regex::new("Failed to update ChannelMonitor for channel [0-9a-f]*.")
- .unwrap(),
+ regex::Regex::new("Failed to update ChannelMonitor").unwrap(),
1,
);
diff --git a/lightning/src/ln/channel.rs b/lightning/src/ln/channel.rs
index c137a72..717cda3 100644
--- a/lightning/src/ln/channel.rs
+++ b/lightning/src/ln/channel.rs
@@ -5209,8 +5209,8 @@ where
{
log_info!(
logger,
- "Attempting to fail HTLC due to fee spike buffer violation in channel {}. Rebalancing is required.",
- &self.channel_id(),
+ "Attempting to fail HTLC due to fee spike buffer violation. Rebalancing is required.",
+
);
return Err(LocalHTLCFailureReason::FeeSpikeBuffer);
}
@@ -6273,11 +6273,7 @@ where
{
let signatures = self.get_initial_counterparty_commitment_signatures(funding, logger);
if let Some((signature, htlc_signatures)) = signatures {
- log_info!(
- logger,
- "Generated commitment_signed for peer for channel {}",
- &self.channel_id()
- );
+ log_info!(logger, "Generated commitment_signed for peer",);
if matches!(self.channel_state, ChannelState::FundingNegotiated(_)) {
// We shouldn't expect any HTLCs before `ChannelReady`.
debug_assert!(htlc_signatures.is_empty());
@@ -6378,9 +6374,9 @@ where
log_info!(
logger,
- "Funding txid {} for channel {} confirmed in block {}",
+ "Funding txid {} confirmed in block {}",
funding_txo.txid,
- &self.channel_id(),
+
block_hash,
);
@@ -7358,8 +7354,7 @@ where
}
log_trace!(
logger,
- "Adding HTLC claim to holding_cell in channel {}! Current state: {}",
- &self.context.channel_id(),
+ "Adding HTLC claim to holding_cell! Current state: {}",
self.context.channel_state.to_u32()
);
self.context.holding_cell_htlc_updates.push(HTLCUpdateAwaitingACK::ClaimHTLC {
@@ -7390,9 +7385,8 @@ where
}
log_trace!(
logger,
- "Upgrading HTLC {} to LocalRemoved with a Fulfill in channel {}!",
+ "Upgrading HTLC {} to LocalRemoved with a Fulfill!",
&htlc.payment_hash,
- &self.context.channel_id
);
htlc.state = InboundHTLCState::LocalRemoved(InboundHTLCRemovalReason::Fulfill(
payment_preimage_arg.clone(),
@@ -7552,13 +7546,13 @@ where
_ => {}
}
}
- log_trace!(logger, "Placing failure for HTLC ID {} in holding cell in channel {}.", htlc_id_arg, &self.context.channel_id());
+ log_trace!(logger, "Placing failure for HTLC ID {} in holding cell.", htlc_id_arg);
self.context.holding_cell_htlc_updates.push(err_contents.to_htlc_update_awaiting_ack(htlc_id_arg));
return Ok(None);
}
- log_trace!(logger, "Failing HTLC ID {} back with {} message in channel {}.", htlc_id_arg,
- E::Message::name(), &self.context.channel_id());
+ log_trace!(logger, "Failing HTLC ID {} back with {} message.", htlc_id_arg,
+ E::Message::name());
{
let htlc = &mut self.context.pending_inbound_htlcs[pending_idx];
htlc.state = err_contents.clone().to_inbound_htlc_state();
@@ -7925,15 +7919,17 @@ where
let counterparty_bitcoin_tx = counterparty_trusted_tx.built_transaction();
log_trace!(
logger,
- "Splice initial counterparty tx for channel {} is: txid {} tx {}",
- &self.context.channel_id(),
+ "Splice initial counterparty tx is: txid {} tx {}",
counterparty_bitcoin_tx.txid,
encode::serialize_hex(&counterparty_bitcoin_tx.transaction)
);
}
- log_info!(logger, "Received splice initial commitment_signed from peer for channel {} with funding txid {}",
- &self.context.channel_id(), pending_splice_funding.get_funding_txo().unwrap().txid);
+ log_info!(
+ logger,
+ "Received splice initial commitment_signed from peer with funding txid {}",
+ pending_splice_funding.get_funding_txo().unwrap().txid
+ );
self.context.latest_monitor_update_id += 1;
let monitor_update = ChannelMonitorUpdate {
@@ -8231,8 +8227,8 @@ where
self.context.latest_monitor_update_id = monitor_update.update_id;
monitor_update.updates.append(&mut additional_update.updates);
}
- log_debug!(logger, "Received valid commitment_signed from peer in channel {}, updated HTLC state but awaiting a monitor update resolution to reply.",
- &self.context.channel_id);
+ log_debug!(logger, "Received valid commitment_signed from peer, updated HTLC state but awaiting a monitor update resolution to reply.",
+ );
return Ok(self.push_ret_blockable_mon_update(monitor_update));
}
@@ -8300,14 +8296,13 @@ where
{
log_trace!(
logger,
- "Freeing holding cell with {} HTLC updates{} in channel {}",
+ "Freeing holding cell with {} HTLC updates{}",
self.context.holding_cell_htlc_updates.len(),
if self.context.holding_cell_update_fee.is_some() {
" and a fee update"
} else {
""
},
- &self.context.channel_id()
);
let mut monitor_update = ChannelMonitorUpdate {
@@ -8364,7 +8359,12 @@ where
update_add_count += 1;
},
Err((_, msg)) => {
- log_info!(logger, "Failed to send HTLC with payment_hash {} due to {} in channel {}", &payment_hash, msg, &self.context.channel_id());
+ log_info!(
+ logger,
+ "Failed to send HTLC with payment_hash {} due to {}",
+ &payment_hash,
+ msg
+ );
// If we fail to send here, then this HTLC should be failed
// backwards. Failing to send here indicates that this HTLC may
// keep being put back into the holding cell without ever being
@@ -8457,8 +8457,8 @@ where
self.context.latest_monitor_update_id = monitor_update.update_id;
monitor_update.updates.append(&mut additional_update.updates);
- log_debug!(logger, "Freeing holding cell in channel {} resulted in {}{} HTLCs added, {} HTLCs fulfilled, and {} HTLCs failed.",
- &self.context.channel_id(), if update_fee.is_some() { "a fee update, " } else { "" },
+ log_debug!(logger, "Freeing holding cell resulted in {}{} HTLCs added, {} HTLCs fulfilled, and {} HTLCs failed.",
+ if update_fee.is_some() { "a fee update, " } else { "" },
update_add_count, update_fulfill_count, update_fail_count);
self.monitor_updating_paused(false, true, false, Vec::new(), Vec::new(), Vec::new());
@@ -8595,11 +8595,7 @@ where
self.context.announcement_sigs_state = AnnouncementSigsState::PeerReceived;
}
- log_trace!(
- logger,
- "Updating HTLCs on receipt of RAA in channel {}...",
- &self.context.channel_id()
- );
+ log_trace!(logger, "Updating HTLCs on receipt of RAA...");
let mut to_forward_infos = Vec::new();
let mut pending_update_adds = Vec::new();
let mut revoked_htlcs = Vec::new();
@@ -8823,8 +8819,8 @@ where
self.context.latest_monitor_update_id = monitor_update.update_id;
monitor_update.updates.append(&mut additional_update.updates);
- log_debug!(logger, "Received a valid revoke_and_ack for channel {} with holding cell HTLCs freed. {} monitor update.",
- &self.context.channel_id(), release_state_str);
+ log_debug!(logger, "Received a valid revoke_and_ack with holding cell HTLCs freed. {} monitor update.",
+ release_state_str);
self.monitor_updating_paused(
false,
@@ -8852,8 +8848,7 @@ where
log_debug!(
logger,
- "Received a valid revoke_and_ack for channel {}. {} monitor update.",
- &self.context.channel_id(),
+ "Received a valid revoke_and_ack. {} monitor update.",
release_state_str
);
if self.context.channel_state.can_generate_new_commitment() {
@@ -8869,12 +8864,7 @@ where
} else {
"can continue progress"
};
- log_debug!(
- logger,
- "Holding back commitment update until channel {} {}",
- &self.context.channel_id,
- reason
- );
+ log_debug!(logger, "Holding back commitment update until {}", reason);
}
self.monitor_updating_paused(
@@ -8887,8 +8877,8 @@ where
);
return_with_htlcs_to_fail!(htlcs_to_fail);
} else {
- log_debug!(logger, "Received a valid revoke_and_ack for channel {} with no reply necessary. {} monitor update.",
- &self.context.channel_id(), release_state_str);
+ log_debug!(logger, "Received a valid revoke_and_ack with no reply necessary. {} monitor update.",
+ release_state_str);
self.monitor_updating_paused(
false,
@@ -8942,9 +8932,8 @@ where
{
log_info!(
logger,
- "Sending 0conf splice_locked txid {} to our peer for channel {}",
+ "Sending 0conf splice_locked txid {} to our peer",
splice_txid,
- &self.context.channel_id
);
}
@@ -9619,12 +9608,12 @@ where
}
}
if !self.holder_commitment_point.can_advance() {
- log_trace!(logger, "Last revoke-and-ack pending in channel {} for sequence {} because the next per-commitment point is not available",
- &self.context.channel_id(), self.holder_commitment_point.next_transaction_number());
+ log_trace!(logger, "Last revoke-and-ack pending for sequence {} because the next per-commitment point is not available",
+ self.holder_commitment_point.next_transaction_number());
}
if per_commitment_secret.is_none() {
- log_trace!(logger, "Last revoke-and-ack pending in channel {} for sequence {} because the next per-commitment secret for {} is not available",
- &self.context.channel_id(), self.holder_commitment_point.next_transaction_number(),
+ log_trace!(logger, "Last revoke-and-ack pending for sequence {} because the next per-commitment secret for {} is not available",
+ self.holder_commitment_point.next_transaction_number(),
self.holder_commitment_point.next_transaction_number() + 2);
}
// Technically if HolderCommitmentPoint::can_advance is false,
@@ -9633,8 +9622,8 @@ where
// CS before we have any commitment point available. Blocking our
// RAA here is a convenient way to make sure that post-funding
// we're only ever waiting on one commitment point at a time.
- log_trace!(logger, "Last revoke-and-ack pending in channel {} for sequence {} because the next per-commitment point is not available",
- &self.context.channel_id(), self.holder_commitment_point.next_transaction_number());
+ log_trace!(logger, "Last revoke-and-ack pending for sequence {} because the next per-commitment point is not available",
+ self.holder_commitment_point.next_transaction_number());
self.context.signer_pending_revoke_and_ack = true;
None
}
@@ -9714,8 +9703,8 @@ where
None
};
- log_trace!(logger, "Regenerating latest commitment update in channel {} with{} {} update_adds, {} update_fulfills, {} update_fails, and {} update_fail_malformeds",
- &self.context.channel_id(), if update_fee.is_some() { " update_fee," } else { "" },
+ log_trace!(logger, "Regenerating latest commitment update with{} {} update_adds, {} update_fulfills, {} update_fails, and {} update_fail_malformeds",
+ if update_fee.is_some() { " update_fee," } else { "" },
update_add_htlcs.len(), update_fulfill_htlcs.len(), update_fail_htlcs.len(), update_fail_malformed_htlcs.len());
let commitment_signed = if let Ok(update) = self.send_commitment_no_state_update(logger) {
if self.context.signer_pending_commitment_update {
@@ -10054,9 +10043,9 @@ where
if msg.next_local_commitment_number == next_counterparty_commitment_number {
if required_revoke.is_some() || self.context.signer_pending_revoke_and_ack {
- log_debug!(logger, "Reconnected channel {} with only lost outbound RAA", &self.context.channel_id());
+ log_debug!(logger, "Reconnected with only lost outbound RAA");
} else {
- log_debug!(logger, "Reconnected channel {} with no loss", &self.context.channel_id());
+ log_debug!(logger, "Reconnected with no loss");
}
Ok(ReestablishResponses {
@@ -10079,9 +10068,9 @@ where
assert!(tx_signatures.is_none());
if required_revoke.is_some() || self.context.signer_pending_revoke_and_ack {
- log_debug!(logger, "Reconnected channel {} with lost outbound RAA and lost remote commitment tx", &self.context.channel_id());
+ log_debug!(logger, "Reconnected channel with lost outbound RAA and lost remote commitment tx");
} else {
- log_debug!(logger, "Reconnected channel {} with only lost remote commitment tx", &self.context.channel_id());
+ log_debug!(logger, "Reconnected channel with only lost remote commitment tx");
}
if self.context.channel_state.is_monitor_update_in_progress() {
@@ -10099,7 +10088,7 @@ where
} else {
let commitment_update = if self.context.resend_order == RAACommitmentOrder::RevokeAndACKFirst
&& self.context.signer_pending_revoke_and_ack {
- log_trace!(logger, "Reconnected channel {} with lost outbound RAA and lost remote commitment tx, but unable to send due to resend order, waiting on signer for revoke and ack", &self.context.channel_id());
+ log_trace!(logger, "Reconnected channel with lost outbound RAA and lost remote commitment tx, but unable to send due to resend order, waiting on signer for revoke and ack");
self.context.signer_pending_commitment_update = true;
None
} else {
@@ -10107,7 +10096,7 @@ where
};
let raa = if self.context.resend_order == RAACommitmentOrder::CommitmentFirst
&& self.context.signer_pending_commitment_update && required_revoke.is_some() {
- log_trace!(logger, "Reconnected channel {} with lost outbound RAA and lost remote commitment tx, but unable to send due to resend order, waiting on signer for commitment update", &self.context.channel_id());
+ log_trace!(logger, "Reconnected channel with lost outbound RAA and lost remote commitment tx, but unable to send due to resend order, waiting on signer for commitment update");
self.context.signer_pending_revoke_and_ack = true;
None
} else {
@@ -10910,14 +10899,12 @@ where
pub fn on_startup_drop_completed_blocked_mon_updates_through<L: Logger>(
&mut self, logger: &L, loaded_mon_update_id: u64,
) {
- let channel_id = self.context.channel_id();
self.context.blocked_monitor_updates.retain(|update| {
if update.update.update_id <= loaded_mon_update_id {
log_info!(
logger,
- "Dropping completed ChannelMonitorUpdate id {} on channel {} due to a stale ChannelManager",
+ "Dropping completed ChannelMonitorUpdate id {} due to a stale ChannelManager",
update.update.update_id,
- channel_id,
);
false
} else {
@@ -11130,21 +11117,11 @@ where
return None;
}
} else {
- log_info!(
- logger,
- "Waiting on splice_locked txid {} for channel {}",
- splice_txid,
- &self.context.channel_id,
- );
+ log_info!(logger, "Waiting on splice_locked txid {}", splice_txid);
return None;
}
- log_info!(
- logger,
- "Promoting splice funding txid {} for channel {}",
- splice_txid,
- &self.context.channel_id,
- );
+ log_info!(logger, "Promoting splice funding txid {}", splice_txid);
let discarded_funding = {
// Scope `funding` to avoid unintentionally using it later since it is swapped below.
@@ -11250,7 +11227,7 @@ where
}
if let Some(channel_ready) = self.check_get_channel_ready(height, logger) {
- log_info!(logger, "Sending a channel_ready to our peer for channel {}", &self.context.channel_id);
+ log_info!(logger, "Sending a channel_ready to our peer");
let announcement_sigs = self.get_announcement_sigs(node_signer, chain_hash, user_config, height, logger);
return Ok((Some(FundingConfirmedMessage::Establishment(channel_ready)), announcement_sigs));
}
@@ -11376,7 +11353,7 @@ where
let announcement_sigs = if let Some((chain_hash, node_signer, user_config)) = chain_node_signer {
self.get_announcement_sigs(node_signer, chain_hash, user_config, height, logger)
} else { None };
- log_info!(logger, "Sending a channel_ready to our peer for channel {}", &self.context.channel_id);
+ log_info!(logger, "Sending a channel_ready to our peer");
return Ok((Some(FundingConfirmedMessage::Establishment(channel_ready)), timed_out_htlcs, announcement_sigs));
}
@@ -11399,7 +11376,7 @@ where
}
} else if !self.funding.is_outbound() && self.funding.funding_tx_confirmed_in.is_none() &&
height >= self.context.channel_creation_height + FUNDING_CONF_DEADLINE_BLOCKS {
- log_info!(logger, "Closing channel {} due to funding timeout", &self.context.channel_id);
+ log_info!(logger, "Closing channel due to funding timeout");
// If funding_tx_confirmed_in is unset, the channel must not be active
assert!(self.context.channel_state <= ChannelState::ChannelReady(ChannelReadyFlags::new()));
assert!(!self.context.channel_state.is_our_channel_ready());
@@ -11445,9 +11422,9 @@ where
height,
) {
log_info!(
- logger, "Sending splice_locked txid {} to our peer for channel {}",
+ logger, "Sending splice_locked txid {} to our peer",
splice_locked.splice_txid,
- &self.context.channel_id
+
);
let (funding_txo, monitor_update, announcement_sigs, discarded_funding) = chain_node_signer
@@ -11608,7 +11585,7 @@ where
return None;
}
- log_trace!(logger, "Creating an announcement_signatures message for channel {}", &self.context.channel_id());
+ log_trace!(logger, "Creating an announcement_signatures message");
let announcement = match self.get_channel_announcement(node_signer, chain_hash, user_config) {
Ok(a) => a,
Err(e) => {
@@ -11816,7 +11793,7 @@ where
let dummy_pubkey = PublicKey::from_slice(&pk).unwrap();
let remote_last_secret = if self.context.counterparty_next_commitment_transaction_number + 1 < INITIAL_COMMITMENT_NUMBER {
let remote_last_secret = self.context.commitment_secrets.get_secret(self.context.counterparty_next_commitment_transaction_number + 2).unwrap();
- log_trace!(logger, "Enough info to generate a Data Loss Protect with per_commitment_secret {} for channel {}", log_bytes!(remote_last_secret), &self.context.channel_id());
+ log_trace!(logger, "Enough info to generate a Data Loss Protect with per_commitment_secret {}", log_bytes!(remote_last_secret));
remote_last_secret
} else {
log_info!(logger, "Sending a data_loss_protect with no previous remote per_commitment_secret for channel {}", &self.context.channel_id());
@@ -12436,12 +12413,7 @@ where
NS::Target: NodeSigner,
L::Target: Logger,
{
- log_info!(
- logger,
- "Received splice_locked txid {} from our peer for channel {}",
- msg.splice_txid,
- &self.context.channel_id,
- );
+ log_info!(logger, "Received splice_locked txid {} from our peer", msg.splice_txid,);
let pending_splice = match self.pending_splice.as_mut() {
Some(pending_splice) => pending_splice,
@@ -12463,9 +12435,8 @@ where
if pending_splice.sent_funding_txid.is_none() {
log_info!(
logger,
- "Waiting for enough confirmations to send splice_locked txid {} for channel {}",
+ "Waiting for enough confirmations to send splice_locked txid {}",
msg.splice_txid,
- &self.context.channel_id,
);
return Ok(None);
}
@@ -12824,19 +12795,19 @@ where
htlc_signatures = res.1;
let trusted_tx = counterparty_commitment_tx.trust();
- log_trace!(logger, "Signed remote commitment tx {} (txid {}) with redeemscript {} -> {} in channel {}",
+ log_trace!(logger, "Signed remote commitment tx {} (txid {}) with redeemscript {} -> {}",
encode::serialize_hex(&trusted_tx.built_transaction().transaction),
&trusted_tx.txid(), encode::serialize_hex(&funding.get_funding_redeemscript()),
- log_bytes!(signature.serialize_compact()[..]), &self.context.channel_id());
+ log_bytes!(signature.serialize_compact()[..]));
let counterparty_keys = trusted_tx.keys();
debug_assert_eq!(htlc_signatures.len(), trusted_tx.nondust_htlcs().len());
for (ref htlc_sig, ref htlc) in htlc_signatures.iter().zip(trusted_tx.nondust_htlcs()) {
- log_trace!(logger, "Signed remote HTLC tx {} with redeemscript {} with pubkey {} -> {} in channel {}",
+ log_trace!(logger, "Signed remote HTLC tx {} with redeemscript {} with pubkey {} -> {}",
encode::serialize_hex(&chan_utils::build_htlc_transaction(&trusted_tx.txid(), trusted_tx.negotiated_feerate_per_kw(), funding.get_holder_selected_contest_delay(), htlc, funding.get_channel_type(), &counterparty_keys.broadcaster_delayed_payment_key, &counterparty_keys.revocation_key)),
encode::serialize_hex(&chan_utils::get_htlc_redeemscript(&htlc, funding.get_channel_type(), &counterparty_keys)),
log_bytes!(counterparty_keys.broadcaster_htlc_key.to_public_key().serialize()),
- log_bytes!(htlc_sig.serialize_compact()[..]), &self.context.channel_id());
+ log_bytes!(htlc_sig.serialize_compact()[..]));
}
}
diff --git a/lightning/src/ln/channelmanager.rs b/lightning/src/ln/channelmanager.rs
index 6d83d61..bf4d0f6 100644
--- a/lightning/src/ln/channelmanager.rs
+++ b/lightning/src/ln/channelmanager.rs
@@ -3366,7 +3366,7 @@ macro_rules! convert_channel_err {
ChannelError::Close((msg, reason)) => {
let (mut shutdown_res, chan_update) = $close(reason);
let logger = WithChannelContext::from(&$self.logger, &$chan.context(), None);
- log_error!(logger, "Closed channel {} due to close-required error: {}", $channel_id, msg);
+ log_error!(logger, "Closed channel due to close-required error: {}", msg);
$locked_close(&mut shutdown_res, $chan);
let err =
MsgHandleErrInternal::from_finish_shutdown(msg, $channel_id, shutdown_res, chan_update);
@@ -3665,7 +3665,7 @@ macro_rules! handle_monitor_update_completion {
/// Returns whether the monitor update is completed, `false` if the update is in-progress.
fn handle_monitor_update_res<CM: AChannelManager, LG: Logger>(
- cm: &CM, update_res: ChannelMonitorUpdateStatus, channel_id: ChannelId, logger: LG,
+ cm: &CM, update_res: ChannelMonitorUpdateStatus, logger: LG,
) -> bool {
debug_assert!(cm.get_cm().background_events_processed_since_startup.load(Ordering::Acquire));
match update_res {
@@ -3679,8 +3679,10 @@ fn handle_monitor_update_res<CM: AChannelManager, LG: Logger>(
if cm.get_cm().monitor_update_type.swap(1, Ordering::Relaxed) == 2 {
panic!("Cannot use both ChannelMonitorUpdateStatus modes InProgress and Completed without restart");
}
- log_debug!(logger, "ChannelMonitor update for {} in flight, holding messages until the update completes.",
- channel_id);
+ log_debug!(
+ logger,
+ "ChannelMonitor update in flight, holding messages until the update completes.",
+ );
false
},
ChannelMonitorUpdateStatus::Completed => {
@@ -3696,8 +3698,7 @@ fn handle_monitor_update_res<CM: AChannelManager, LG: Logger>(
macro_rules! handle_initial_monitor {
($self: ident, $update_res: expr, $peer_state_lock: expr, $peer_state: expr, $per_peer_state_lock: expr, $chan: expr) => {
let logger = WithChannelContext::from(&$self.logger, &$chan.context, None);
- let update_completed =
- handle_monitor_update_res($self, $update_res, $chan.context.channel_id(), logger);
+ let update_completed = handle_monitor_update_res($self, $update_res, logger);
if update_completed {
handle_monitor_update_completion!(
$self,
@@ -3732,7 +3733,7 @@ fn handle_new_monitor_update_internal<CM: AChannelManager, LG: Logger>(
if cm.get_cm().background_events_processed_since_startup.load(Ordering::Acquire) {
let update_res =
cm.get_cm().chain_monitor.update_channel(channel_id, &in_flight_updates[update_idx]);
- let update_completed = handle_monitor_update_res(cm, update_res, channel_id, logger);
+ let update_completed = handle_monitor_update_res(cm, update_res, logger);
if update_completed {
let _ = in_flight_updates.remove(update_idx);
}
@@ -4648,7 +4649,7 @@ where
};
if let Some(mut chan) = peer_state.channel_by_id.remove(channel_id) {
- log_error!(logger, "Force-closing channel {}", channel_id);
+ log_error!(logger, "Force-closing channel");
let err = ChannelError::Close((message, reason));
let (_, mut e) = convert_channel_err!(self, peer_state, err, &mut chan);
mem::drop(peer_state_lock);
@@ -4661,7 +4662,7 @@ where
let _ = handle_error!(self, Err::<(), _>(e), *peer_node_id);
Ok(())
} else if peer_state.inbound_channel_request_by_id.remove(channel_id).is_some() {
- log_error!(logger, "Force-closing inbound channel request {}", &channel_id);
+ log_error!(logger, "Force-closing inbound channel request");
if !is_from_counterparty && peer_state.is_connected {
peer_state.pending_msg_events.push(
MessageSendEvent::HandleError {
@@ -5154,11 +5155,7 @@ where
});
}
let logger = WithChannelContext::from(&self.logger, &chan.context, None);
- log_trace!(
- logger,
- "Attempting to generate broadcast channel update for channel {}",
- &chan.context.channel_id()
- );
+ log_trace!(logger, "Attempting to generate broadcast channel update",);
self.get_channel_update_for_unicast(chan)
}
@@ -5179,14 +5176,14 @@ where
&self, chan: &FundedChannel<SP>,
) -> Result<(msgs::ChannelUpdate, NodeId, NodeId), LightningError> {
let logger = WithChannelContext::from(&self.logger, &chan.context, None);
- log_trace!(logger, "Attempting to generate channel update for channel {}", chan.context.channel_id());
+ log_trace!(logger, "Attempting to generate channel update");
let short_channel_id = match chan.funding.get_short_channel_id().or(chan.context.latest_inbound_scid_alias()) {
None => return Err(LightningError{err: "Channel not yet established".to_owned(), action: msgs::ErrorAction::IgnoreError}),
Some(id) => id,
};
let logger = WithChannelContext::from(&self.logger, &chan.context, None);
- log_trace!(logger, "Generating channel update for channel {}", chan.context.channel_id());
+ log_trace!(logger, "Generating channel update");
let our_node_id = NodeId::from_pubkey(&self.our_network_pubkey);
let their_node_id = NodeId::from_pubkey(&chan.context.get_counterparty_node_id());
let were_node_one = our_node_id < their_node_id;
@@ -6777,7 +6774,7 @@ where
},
None => {
let error = format!(
- "Channel with id {next_hop_channel_id} not found for the passed counterparty node_id {next_node_id}"
+ "Channel not found for the passed counterparty node_id {next_node_id}"
);
let logger = WithContext::from(
&self.logger,
@@ -6786,7 +6783,11 @@ where
None,
);
log_error!(logger, "{error} when attempting to forward intercepted HTLC");
- return Err(APIError::ChannelUnavailable { err: error });
+ return Err(APIError::ChannelUnavailable {
+ err: format!(
+ "Channel with id {next_hop_channel_id} not found for the passed counterparty node_id {next_node_id}"
+ ),
+ });
},
}
};
@@ -7520,8 +7521,8 @@ where
} else {
"alternate"
};
- log_trace!(logger, "Forwarding HTLC from SCID {} with payment_hash {} and next hop SCID {} over {} channel {} with corresponding peer {}",
- prev_outbound_scid_alias, &payment_hash, short_chan_id, channel_description, optimal_channel.context.channel_id(), &counterparty_node_id);
+ log_trace!(logger, "Forwarding HTLC from SCID {} with payment_hash {} and next hop SCID {} over {} with corresponding peer {}",
+ prev_outbound_scid_alias, &payment_hash, short_chan_id, channel_description, &counterparty_node_id);
if let Err((reason, msg)) = optimal_channel.queue_add_htlc(
*outgoing_amt_msat,
*payment_hash,
@@ -8083,8 +8084,8 @@ where
chan_id, chan.context.get_feerate_sat_per_1000_weight(), new_feerate);
return NotifyOption::SkipPersistNoEvents;
}
- log_trace!(logger, "Channel {} qualifies for a feerate change from {} to {}.",
- &chan_id, chan.context.get_feerate_sat_per_1000_weight(), new_feerate);
+ log_trace!(logger, "Channel qualifies for a feerate change from {} to {}.",
+ chan.context.get_feerate_sat_per_1000_weight(), new_feerate);
chan.queue_update_fee(new_feerate, &self.fee_estimator, &&logger);
NotifyOption::DoPersist
@@ -8223,8 +8224,8 @@ where
if peer_state.is_connected {
if funded_chan.should_disconnect_peer_awaiting_response() {
let logger = WithChannelContext::from(&self.logger, &funded_chan.context, None);
- log_debug!(logger, "Disconnecting peer {} due to not making any progress on channel {}",
- counterparty_node_id, chan_id);
+ log_debug!(logger, "Disconnecting peer {} due to not making any progress",
+ counterparty_node_id);
pending_msg_events.push(MessageSendEvent::HandleError {
node_id: counterparty_node_id,
action: msgs::ErrorAction::DisconnectPeerWithWarning {
@@ -8246,8 +8247,8 @@ where
let context = chan.context();
let logger = WithChannelContext::from(&self.logger, context, None);
log_error!(logger,
- "Force-closing pending channel with ID {} for not establishing in a timely manner",
- context.channel_id());
+ "Force-closing pending channel for not establishing in a timely manner",
+ );
let reason = ClosureReason::FundingTimedOut;
let msg = "Force-closing pending channel due to timeout awaiting establishment handshake".to_owned();
let err = ChannelError::Close((msg, reason));
@@ -8972,8 +8973,11 @@ where
let (action_opt, raa_blocker_opt) =
completion_action(Some(htlc_value_msat), false);
if let Some(action) = action_opt {
- log_trace!(logger, "Tracking monitor update completion action for channel {}: {:?}",
- chan_id, action);
+ log_trace!(
+ logger,
+ "Tracking monitor update completion action: {:?}",
+ action
+ );
peer_state
.monitor_update_blocked_actions
.entry(chan_id)
@@ -9044,8 +9048,8 @@ where
mem::drop(peer_state_lock);
- log_trace!(logger, "Completing monitor update completion action for channel {} as claim was redundant: {:?}",
- chan_id, action);
+ log_trace!(logger, "Completing monitor update completion action as claim was redundant: {:?}",
+ action);
if let MonitorUpdateCompletionAction::FreeOtherChannelImmediately {
downstream_counterparty_node_id: node_id,
blocking_action: blocker,
@@ -9146,8 +9150,7 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
if let Some(action) = action_opt {
log_trace!(
logger,
- "Tracking monitor update completion action for closed channel {}: {:?}",
- chan_id,
+ "Tracking monitor update completion action for closed channel: {:?}",
action
);
peer_state
@@ -9530,8 +9533,7 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
channel_ready_order: ChannelReadyOrder,
) -> (Option<(u64, PublicKey, OutPoint, ChannelId, u128, Vec<(PendingHTLCInfo, u64)>)>, Option<(u64, Vec<msgs::UpdateAddHTLC>)>) {
let logger = WithChannelContext::from(&self.logger, &channel.context, None);
- log_trace!(logger, "Handling channel resumption for channel {} with {} RAA, {} commitment update, {} pending forwards, {} pending update_add_htlcs, {}broadcasting funding, {} channel ready, {} announcement, {} tx_signatures, {} tx_abort",
- &channel.context.channel_id(),
+ log_trace!(logger, "Handling channel resumption with {} RAA, {} commitment update, {} pending forwards, {} pending update_add_htlcs, {}broadcasting funding, {} channel ready, {} announcement, {} tx_signatures, {} tx_abort",
if raa.is_some() { "an" } else { "no" },
if commitment_update.is_some() { "a" } else { "no" },
pending_forwards.len(), pending_update_adds.len(),
@@ -10821,7 +10823,7 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
let announcement_sigs_opt =
try_channel_entry!(self, peer_state, res, chan_entry);
if let Some(announcement_sigs) = announcement_sigs_opt {
- log_trace!(logger, "Sending announcement_signatures for channel {}", chan.context.channel_id());
+ log_trace!(logger, "Sending announcement_signatures");
peer_state.pending_msg_events.push(MessageSendEvent::SendAnnouncementSignatures {
node_id: counterparty_node_id.clone(),
msg: announcement_sigs,
@@ -10832,7 +10834,7 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
// counterparty's announcement_signatures. Thus, we only bother to send a
// channel_update here if the channel is not public, i.e. we're not sending an
// announcement_signatures.
- log_trace!(logger, "Sending private initial channel_update for our counterparty on channel {}", chan.context.channel_id());
+ log_trace!(logger, "Sending private initial channel_update for our counterparty");
if let Ok((msg, _, _)) = self.get_channel_update_for_unicast(chan) {
peer_state.pending_msg_events.push(MessageSendEvent::SendChannelUpdate {
node_id: counterparty_node_id.clone(),
@@ -10884,9 +10886,15 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
if !chan.received_shutdown() {
let logger =
WithChannelContext::from(&self.logger, &chan.context, None);
- log_info!(logger, "Received a shutdown message from our counterparty for channel {}{}.",
- msg.channel_id,
- if chan.sent_shutdown() { " after we initiated shutdown" } else { "" });
+ log_info!(
+ logger,
+ "Received a shutdown message from our counterparty{}.",
+ if chan.sent_shutdown() {
+ " after we initiated shutdown"
+ } else {
+ ""
+ }
+ );
}
let funding_txo_opt = chan.funding.get_funding_txo();
@@ -10926,7 +10934,7 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
chan_entry.get().context(),
None,
);
- log_error!(logger, "Immediately closing unfunded channel {} as peer asked to cooperatively shut it down (which is unnecessary)", &msg.channel_id);
+ log_error!(logger, "Immediately closing unfunded channel as peer asked to cooperatively shut it down (which is unnecessary)");
let reason = ClosureReason::CounterpartyCoopClosedUnfundedChannel;
let err = ChannelError::Close((reason.to_string(), reason));
let mut chan = chan_entry.remove();
@@ -11089,8 +11097,8 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
if let HTLCSource::PreviousHopData(prev_hop) = &res.0 {
let logger = WithChannelContext::from(&self.logger, &chan.context, None);
log_trace!(logger,
- "Holding the next revoke_and_ack from {} until the preimage is durably persisted in the inbound edge's ChannelMonitor",
- msg.channel_id);
+ "Holding the next revoke_and_ack until the preimage is durably persisted in the inbound edge's ChannelMonitor",
+ );
peer_state.actions_blocking_raa_monitor_updates.entry(msg.channel_id)
.or_insert_with(Vec::new)
.push(RAAMonitorUpdateBlockingAction::from_prev_hop_data(&prev_hop));
@@ -11679,7 +11687,7 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
return Ok(NotifyOption::SkipPersistNoEvents);
} else {
let logger = WithChannelContext::from(&self.logger, &chan.context, None);
- log_debug!(logger, "Received channel_update {:?} for channel {}.", msg, chan_id);
+ log_debug!(logger, "Received channel_update {:?}.", msg);
let did_change = try_channel_entry!(self, peer_state, chan.channel_update(&msg), chan_entry);
// If nothing changed after applying their update, we don't need to bother
// persisting.
@@ -11767,8 +11775,8 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
}
},
hash_map::Entry::Vacant(_) => {
- log_debug!(logger, "Sending bogus ChannelReestablish for unknown channel {} to force channel closure",
- msg.channel_id);
+ log_debug!(logger, "Sending bogus ChannelReestablish for unknown channel to force channel closure",
+ );
// Unfortunately, lnd doesn't force close on errors
// (https://github.com/lightningnetwork/lnd/blob/abb1e3463f3a83bbb843d5c399869dbe930ad94f/htlcswitch/link.go#L2119).
// One of the few ways to get an lnd counterparty to force close is by
@@ -11967,11 +11975,7 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
}
if let Some(announcement_sigs) = splice_promotion.announcement_sigs {
- log_trace!(
- logger,
- "Sending announcement_signatures for channel {}",
- chan.context.channel_id()
- );
+ log_trace!(logger, "Sending announcement_signatures",);
peer_state.pending_msg_events.push(
MessageSendEvent::SendAnnouncementSignatures {
node_id: counterparty_node_id.clone(),
@@ -12310,8 +12314,7 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
if let Some(shutdown) = shutdown_result {
let context = chan.context();
let logger = WithChannelContext::from(&self.logger, context, None);
- let chan_id = context.channel_id();
- log_trace!(logger, "Removing channel {} now that the signer is unblocked", chan_id);
+ log_trace!(logger, "Removing channel now that the signer is unblocked");
let (remove, err) = if let Some(funded) = chan.as_funded_mut() {
let err =
convert_channel_err!(self, peer_state, shutdown, funded, COOP_CLOSED);
@@ -13564,8 +13567,8 @@ where
// Check that, while holding the peer lock, we don't have anything else
// blocking monitor updates for this channel. If we do, release the monitor
// update(s) when those blockers complete.
- log_trace!(logger, "Delaying monitor unlock for channel {} as another channel's mon update needs to complete first",
- &channel_id);
+ log_trace!(logger, "Delaying monitor unlock as another channel's mon update needs to complete first",
+ );
break;
}
@@ -13574,8 +13577,8 @@ where
if let Some(chan) = chan_entry.get_mut().as_funded_mut() {
let channel_funding_outpoint = chan.funding_outpoint();
if let Some((monitor_update, further_update_exists)) = chan.unblock_next_blocked_monitor_update() {
- log_debug!(logger, "Unlocking monitor updating for channel {} and updating monitor",
- channel_id);
+ log_debug!(logger, "Unlocking monitor updating and updating monitor",
+ );
handle_new_monitor_update!(self, channel_funding_outpoint, monitor_update,
peer_state_lck, peer_state, per_peer_state, chan);
if further_update_exists {
@@ -13584,8 +13587,8 @@ where
continue;
}
} else {
- log_trace!(logger, "Unlocked monitor updating for channel {} without monitors to update",
- channel_id);
+ log_trace!(logger, "Unlocked monitor updating without monitors to update",
+ );
}
}
}
@@ -14351,7 +14354,7 @@ where
Some(FundingConfirmedMessage::Establishment(channel_ready)) => {
send_channel_ready!(self, pending_msg_events, funded_channel, channel_ready);
if funded_channel.context.is_usable() && peer_state.is_connected {
- log_trace!(logger, "Sending channel_ready with private initial channel_update for our counterparty on channel {}", channel_id);
+ log_trace!(logger, "Sending channel_ready with private initial channel_update for our counterparty");
if let Ok((msg, _, _)) = self.get_channel_update_for_unicast(funded_channel) {
pending_msg_events.push(MessageSendEvent::SendChannelUpdate {
node_id: funded_channel.context.get_counterparty_node_id(),
@@ -14359,7 +14362,7 @@ where
});
}
} else {
- log_trace!(logger, "Sending channel_ready WITHOUT channel_update for {}", channel_id);
+ log_trace!(logger, "Sending channel_ready WITHOUT channel_update");
}
},
Some(FundingConfirmedMessage::Splice(splice_locked, funding_txo, monitor_update_opt, discarded_funding)) => {
@@ -14452,7 +14455,7 @@ where
}
if let Some(announcement_sigs) = announcement_sigs {
if peer_state.is_connected {
- log_trace!(logger, "Sending announcement_signatures for channel {}", funded_channel.context.channel_id());
+ log_trace!(logger, "Sending announcement_signatures");
pending_msg_events.push(MessageSendEvent::SendAnnouncementSignatures {
node_id: funded_channel.context.get_counterparty_node_id(),
msg: announcement_sigs,
@@ -16815,26 +16818,26 @@ where
if channel.context.get_latest_monitor_update_id()
< monitor.get_latest_update_id()
{
- log_error!(logger, " The ChannelMonitor for channel {} is at update_id {} but the ChannelManager is at update_id {}.",
- &channel.context.channel_id(), monitor.get_latest_update_id(), channel.context.get_latest_monitor_update_id());
+ log_error!(logger, " The ChannelMonitor is at update_id {} but the ChannelManager is at update_id {}.",
+ monitor.get_latest_update_id(), channel.context.get_latest_monitor_update_id());
}
if channel.get_cur_holder_commitment_transaction_number()
> monitor.get_cur_holder_commitment_number()
{
- log_error!(logger, " The ChannelMonitor for channel {} is at holder commitment number {} but the ChannelManager is at holder commitment number {}.",
- &channel.context.channel_id(), monitor.get_cur_holder_commitment_number(), channel.get_cur_holder_commitment_transaction_number());
+ log_error!(logger, " The ChannelMonitor is at holder commitment number {} but the ChannelManager is at holder commitment number {}.",
+ monitor.get_cur_holder_commitment_number(), channel.get_cur_holder_commitment_transaction_number());
}
if channel.get_revoked_counterparty_commitment_transaction_number()
> monitor.get_min_seen_secret()
{
- log_error!(logger, " The ChannelMonitor for channel {} is at revoked counterparty transaction number {} but the ChannelManager is at revoked counterparty transaction number {}.",
- &channel.context.channel_id(), monitor.get_min_seen_secret(), channel.get_revoked_counterparty_commitment_transaction_number());
+ log_error!(logger, " The ChannelMonitor is at revoked counterparty transaction number {} but the ChannelManager is at revoked counterparty transaction number {}.",
+ monitor.get_min_seen_secret(), channel.get_revoked_counterparty_commitment_transaction_number());
}
if channel.get_cur_counterparty_commitment_transaction_number()
> monitor.get_cur_counterparty_commitment_number()
{
- log_error!(logger, " The ChannelMonitor for channel {} is at counterparty commitment transaction number {} but the ChannelManager is at counterparty commitment transaction number {}.",
- &channel.context.channel_id(), monitor.get_cur_counterparty_commitment_number(), channel.get_cur_counterparty_commitment_transaction_number());
+ log_error!(logger, " The ChannelMonitor is at counterparty commitment transaction number {} but the ChannelManager is at counterparty commitment transaction number {}.",
+ monitor.get_cur_counterparty_commitment_number(), channel.get_cur_counterparty_commitment_transaction_number());
}
let shutdown_result =
channel.force_shutdown(ClosureReason::OutdatedChannelManager);
@@ -16906,8 +16909,8 @@ where
Some(*payment_hash),
);
log_info!(logger,
- "Failing HTLC with hash {} as it is missing in the ChannelMonitor for channel {} but was present in the (stale) ChannelManager",
- &channel.context.channel_id(), &payment_hash);
+ "Failing HTLC with hash {} as it is missing in the ChannelMonitor but was present in the (stale) ChannelManager",
+ &payment_hash);
failed_htlcs.push((
channel_htlc_source.clone(),
*payment_hash,
@@ -16923,8 +16926,8 @@ where
&logger,
monitor.get_latest_update_id(),
);
- log_info!(logger, "Successfully loaded channel {} at update_id {} against monitor at update id {} with {} blocked updates",
- &channel.context.channel_id(), channel.context.get_latest_monitor_update_id(),
+ log_info!(logger, "Successfully loaded at update_id {} against monitor at update id {} with {} blocked updates",
+ channel.context.get_latest_monitor_update_id(),
monitor.get_latest_update_id(), channel.blocked_monitor_updates_pending());
if let Some(short_channel_id) = channel.funding.get_short_channel_id() {
short_to_chan_info.insert(
@@ -17021,8 +17024,7 @@ where
let channel_id = monitor.channel_id();
log_info!(
logger,
- "Queueing monitor update to ensure missing channel {} is force closed",
- &channel_id
+ "Queueing monitor update to ensure missing channel is force closed",
);
let monitor_update = ChannelMonitorUpdate {
update_id: monitor.get_latest_update_id().saturating_add(1),
@@ -17348,8 +17350,8 @@ where
{
// If the channel is ahead of the monitor, return DangerousValue:
log_error!(logger, "A ChannelMonitor is stale compared to the current ChannelManager! This indicates a potentially-critical violation of the chain::Watch API!");
- log_error!(logger, " The ChannelMonitor for channel {} is at update_id {} with update_id through {} in-flight",
- chan_id, monitor.get_latest_update_id(), max_in_flight_update_id);
+ log_error!(logger, " The ChannelMonitor is at update_id {} with update_id through {} in-flight",
+ monitor.get_latest_update_id(), max_in_flight_update_id);
log_error!(
logger,
" but the ChannelManager is at update_id {}.",
@@ -17567,8 +17569,8 @@ where
let matches = *src_outb_alias == prev_hop_data.prev_outbound_scid_alias &&
update_add_htlc.htlc_id == prev_hop_data.htlc_id;
if matches {
- log_info!(logger, "Removing pending to-decode HTLC with hash {} as it was forwarded to the closed channel {}",
- &htlc.payment_hash, &monitor.channel_id());
+ log_info!(logger, "Removing pending to-decode HTLC with hash {} as it was forwarded to the closed channel",
+ &htlc.payment_hash);
}
!matches
});
diff --git a/lightning/src/ln/functional_tests.rs b/lightning/src/ln/functional_tests.rs
index 679d28d..ff987ca 100644
--- a/lightning/src/ln/functional_tests.rs
+++ b/lightning/src/ln/functional_tests.rs
@@ -5147,7 +5147,7 @@ pub fn test_fail_holding_cell_htlc_upon_free() {
assert_eq!(chan_stat.holding_cell_outbound_amount_msat, 0);
nodes[0].logger.assert_log(
"lightning::ln::channel",
- format!("Freeing holding cell with 1 HTLC updates in channel {}", chan.2),
+ "Freeing holding cell with 1 HTLC updates".to_string(),
1,
);
@@ -5258,7 +5258,7 @@ pub fn test_free_and_fail_holding_cell_htlcs() {
assert_eq!(chan_stat.holding_cell_outbound_amount_msat, 0);
nodes[0].logger.assert_log(
"lightning::ln::channel",
- format!("Freeing holding cell with 2 HTLC updates in channel {}", chan.2),
+ "Freeing holding cell with 2 HTLC updates".to_string(),
1,
);
diff --git a/lightning/src/ln/htlc_reserve_unit_tests.rs b/lightning/src/ln/htlc_reserve_unit_tests.rs
index 3a1fc87..e8f82c3 100644
--- a/lightning/src/ln/htlc_reserve_unit_tests.rs
+++ b/lightning/src/ln/htlc_reserve_unit_tests.rs
@@ -964,8 +964,12 @@ pub fn do_test_fee_spike_buffer(cfg: Option<UserConfig>, htlc_fails: bool) {
},
_ => panic!("Unexpected event"),
};
- nodes[1].logger.assert_log("lightning::ln::channel",
- format!("Attempting to fail HTLC due to fee spike buffer violation in channel {}. Rebalancing is required.", raa_msg.channel_id), 1);
+ nodes[1].logger.assert_log(
+ "lightning::ln::channel",
+ "Attempting to fail HTLC due to fee spike buffer violation. Rebalancing is required."
+ .to_string(),
+ 1,
+ );
check_added_monitors(&nodes[1], 3);
} else {
@@ -2412,8 +2416,12 @@ pub fn do_test_dust_limit_fee_accounting(can_afford: bool) {
},
_ => panic!("Unexpected event"),
};
- nodes[1].logger.assert_log("lightning::ln::channel",
- format!("Attempting to fail HTLC due to fee spike buffer violation in channel {}. Rebalancing is required.", raa_msg.channel_id), 1);
+ nodes[1].logger.assert_log(
+ "lightning::ln::channel",
+ "Attempting to fail HTLC due to fee spike buffer violation. Rebalancing is required."
+ .to_string(),
+ 1,
+ );
check_added_monitors(&nodes[1], 3);
}
diff --git a/lightning/src/ln/invoice_utils.rs b/lightning/src/ln/invoice_utils.rs
index 9af676b..425cc4d 100644
--- a/lightning/src/ln/invoice_utils.rs
+++ b/lightning/src/ln/invoice_utils.rs
@@ -403,7 +403,7 @@ where
if channel.get_inbound_payment_scid().is_none()
|| channel.counterparty.forwarding_info.is_none()
{
- log_trace!(logger, "Ignoring channel {} for invoice route hints", &channel.channel_id);
+ log_trace!(logger, "Ignoring channel for invoice route hints");
continue;
}
@@ -418,8 +418,7 @@ where
// look at the public channels instead.
log_trace!(
logger,
- "Not including channels in invoice route hints on account of public channel {}",
- &channel.channel_id
+ "Not including channels in invoice route hints on account of public channel",
);
return vec![].into_iter().take(MAX_CHANNEL_HINTS).map(route_hint_from_channel);
}
@@ -519,24 +518,15 @@ where
};
if include_channel {
- log_trace!(
- logger,
- "Including channel {} in invoice route hints",
- &channel.channel_id
- );
+ log_trace!(logger, "Including channel in invoice route hints",);
} else if !has_enough_capacity {
log_trace!(
logger,
- "Ignoring channel {} without enough capacity for invoice route hints",
- &channel.channel_id
+ "Ignoring channel without enough capacity for invoice route hints",
);
} else {
debug_assert!(!channel.is_usable || (has_pub_unconf_chan && !channel.is_announced));
- log_trace!(
- logger,
- "Ignoring channel {} with disconnected peer",
- &channel.channel_id
- );
+ log_trace!(logger, "Ignoring channel with disconnected peer",);
}
include_channel
diff --git a/lightning/src/ln/payment_tests.rs b/lightning/src/ln/payment_tests.rs
index ac26f79..c56cffa 100644
--- a/lightning/src/ln/payment_tests.rs
+++ b/lightning/src/ln/payment_tests.rs
@@ -2295,8 +2295,7 @@ fn do_test_intercepted_payment(test: InterceptTest) {
nodes[1].node.forward_intercepted_htlc(intercept_id, &chan_id, node_c_id, outbound_amt);
let err = format!(
"Channel with id {} not found for the passed counterparty node_id {}",
- log_bytes!([42; 32]),
- node_c_id,
+ chan_id, node_c_id,
);
assert_eq!(unknown_chan_id_err, Err(APIError::ChannelUnavailable { err }));
diff --git a/lightning/src/ln/peer_handler.rs b/lightning/src/ln/peer_handler.rs
index 4c379c2..83e2a57 100644
--- a/lightning/src/ln/peer_handler.rs
+++ b/lightning/src/ln/peer_handler.rs
@@ -3121,9 +3121,16 @@ where
self.enqueue_message(&mut *get_peer_for_forwarding!(node_id)?, msg);
},
MessageSendEvent::SendShutdown { ref node_id, ref msg } => {
- log_debug!(WithContext::from(&self.logger, Some(*node_id), Some(msg.channel_id), None), "Handling Shutdown event in peer_handler for node {} for channel {}",
- node_id,
- &msg.channel_id);
+ log_debug!(
+ WithContext::from(
+ &self.logger,
+ Some(*node_id),
+ Some(msg.channel_id),
+ None
+ ),
+ "Handling Shutdown event in peer_handler for node {}",
+ node_id
+ );
self.enqueue_message(&mut *get_peer_for_forwarding!(node_id)?, msg);
},
MessageSendEvent::SendChannelReestablish { ref node_id, ref msg } => {
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.