@@ -2008,7 +2008,7 @@ macro_rules! handle_error {
2008
2008
let counterparty_node_id = shutdown_res.counterparty_node_id;
2009
2009
let channel_id = shutdown_res.channel_id;
2010
2010
let logger = WithContext::from(
2011
- &$self.logger, Some(counterparty_node_id), Some(channel_id),
2011
+ &$self.logger, Some(counterparty_node_id), Some(channel_id), None
2012
2012
);
2013
2013
log_error!(logger, "Force-closing channel: {}", err.err);
2014
2014
@@ -2888,7 +2888,7 @@ where
2888
2888
}
2889
2889
2890
2890
let logger = WithContext::from(
2891
- &self.logger, Some(shutdown_res.counterparty_node_id), Some(shutdown_res.channel_id),
2891
+ &self.logger, Some(shutdown_res.counterparty_node_id), Some(shutdown_res.channel_id), None
2892
2892
);
2893
2893
2894
2894
log_debug!(logger, "Finishing closure of channel due to {} with {} HTLCs to fail",
@@ -2964,7 +2964,7 @@ where
2964
2964
} else {
2965
2965
ClosureReason::HolderForceClosed
2966
2966
};
2967
- let logger = WithContext::from(&self.logger, Some(*peer_node_id), Some(*channel_id));
2967
+ let logger = WithContext::from(&self.logger, Some(*peer_node_id), Some(*channel_id), None );
2968
2968
if let hash_map::Entry::Occupied(chan_phase_entry) = peer_state.channel_by_id.entry(channel_id.clone()) {
2969
2969
log_error!(logger, "Force-closing channel {}", channel_id);
2970
2970
let mut chan_phase = remove_channel_phase!(self, chan_phase_entry);
@@ -3095,7 +3095,7 @@ where
3095
3095
($msg: expr, $err_code: expr, $data: expr) => {
3096
3096
{
3097
3097
log_info!(
3098
- WithContext::from(&self.logger, Some(*counterparty_node_id), Some(msg.channel_id)),
3098
+ WithContext::from(&self.logger, Some(*counterparty_node_id), Some(msg.channel_id), Some(msg.payment_hash) ),
3099
3099
"Failed to accept/forward incoming HTLC: {}", $msg
3100
3100
);
3101
3101
// If `msg.blinding_point` is set, we must always fail with malformed.
@@ -3259,7 +3259,7 @@ where
3259
3259
macro_rules! return_err {
3260
3260
($msg: expr, $err_code: expr, $data: expr) => {
3261
3261
{
3262
- let logger = WithContext::from(&self.logger, Some(*counterparty_node_id), Some(msg.channel_id));
3262
+ let logger = WithContext::from(&self.logger, Some(*counterparty_node_id), Some(msg.channel_id), Some(msg.payment_hash) );
3263
3263
log_info!(logger, "Failed to accept/forward incoming HTLC: {}", $msg);
3264
3264
if msg.blinding_point.is_some() {
3265
3265
return PendingHTLCStatus::Fail(HTLCFailureMsg::Malformed(
@@ -3414,22 +3414,22 @@ where
3414
3414
&self.secp_ctx, &path, &session_priv, total_value, recipient_onion, cur_height,
3415
3415
payment_hash, keysend_preimage, prng_seed
3416
3416
).map_err(|e| {
3417
- let logger = WithContext::from(&self.logger, Some(path.hops.first().unwrap().pubkey), None);
3417
+ let logger = WithContext::from(&self.logger, Some(path.hops.first().unwrap().pubkey), None, Some(*payment_hash) );
3418
3418
log_error!(logger, "Failed to build an onion for path for payment hash {}", payment_hash);
3419
3419
e
3420
3420
})?;
3421
3421
3422
3422
let err: Result<(), _> = loop {
3423
3423
let (counterparty_node_id, id) = match self.short_to_chan_info.read().unwrap().get(&path.hops.first().unwrap().short_channel_id) {
3424
3424
None => {
3425
- let logger = WithContext::from(&self.logger, Some(path.hops.first().unwrap().pubkey), None);
3425
+ let logger = WithContext::from(&self.logger, Some(path.hops.first().unwrap().pubkey), None, Some(*payment_hash) );
3426
3426
log_error!(logger, "Failed to find first-hop for payment hash {}", payment_hash);
3427
3427
return Err(APIError::ChannelUnavailable{err: "No channel available with first hop!".to_owned()})
3428
3428
},
3429
3429
Some((cp_id, chan_id)) => (cp_id.clone(), chan_id.clone()),
3430
3430
};
3431
3431
3432
- let logger = WithContext::from(&self.logger, Some(counterparty_node_id), Some(id));
3432
+ let logger = WithContext::from(&self.logger, Some(counterparty_node_id), Some(id), Some(*payment_hash) );
3433
3433
log_trace!(logger,
3434
3434
"Attempting to send payment with payment hash {} along path with next hop {}",
3435
3435
payment_hash, path.hops.first().unwrap().short_channel_id);
@@ -4201,7 +4201,7 @@ where
4201
4201
None => {
4202
4202
let error = format!("Channel with id {} not found for the passed counterparty node_id {}",
4203
4203
next_hop_channel_id, next_node_id);
4204
- let logger = WithContext::from(&self.logger, Some(next_node_id), Some(*next_hop_channel_id));
4204
+ let logger = WithContext::from(&self.logger, Some(next_node_id), Some(*next_hop_channel_id), None );
4205
4205
log_error!(logger, "{} when attempting to forward intercepted HTLC", error);
4206
4206
return Err(APIError::ChannelUnavailable {
4207
4207
err: error
@@ -4306,7 +4306,7 @@ where
4306
4306
}) => {
4307
4307
macro_rules! failure_handler {
4308
4308
($msg: expr, $err_code: expr, $err_data: expr, $phantom_ss: expr, $next_hop_unknown: expr) => {
4309
- let logger = WithContext::from(&self.logger, forwarding_counterparty, Some(prev_channel_id));
4309
+ let logger = WithContext::from(&self.logger, forwarding_counterparty, Some(prev_channel_id), Some(payment_hash) );
4310
4310
log_info!(logger, "Failed to accept/forward incoming HTLC: {}", $msg);
4311
4311
4312
4312
let htlc_source = HTLCSource::PreviousHopData(HTLCPreviousHopData {
@@ -5075,7 +5075,7 @@ where
5075
5075
5076
5076
for (chan_id, req) in peer_state.inbound_channel_request_by_id.iter_mut() {
5077
5077
if { req.ticks_remaining -= 1 ; req.ticks_remaining } <= 0 {
5078
- let logger = WithContext::from(&self.logger, Some(counterparty_node_id), Some(*chan_id));
5078
+ let logger = WithContext::from(&self.logger, Some(counterparty_node_id), Some(*chan_id), None );
5079
5079
log_error!(logger, "Force-closing unaccepted inbound channel {} for not accepting in a timely manner", &chan_id);
5080
5080
peer_state.pending_msg_events.push(
5081
5081
events::MessageSendEvent::HandleError {
@@ -5356,7 +5356,7 @@ where
5356
5356
ref phantom_shared_secret, outpoint: _, ref blinded_failure, ref channel_id, ..
5357
5357
}) => {
5358
5358
log_trace!(
5359
- WithContext::from(&self.logger, None, Some(*channel_id)),
5359
+ WithContext::from(&self.logger, None, Some(*channel_id), Some(*payment_hash) ),
5360
5360
"Failing {}HTLC with payment_hash {} backwards from us: {:?}",
5361
5361
if blinded_failure.is_some() { "blinded " } else { "" }, &payment_hash, onion_error
5362
5362
);
@@ -5552,7 +5552,7 @@ where
5552
5552
if let msgs::ErrorAction::IgnoreError = err.err.action {
5553
5553
// We got a temporary failure updating monitor, but will claim the
5554
5554
// HTLC when the monitor updating is restored (or on chain).
5555
- let logger = WithContext::from(&self.logger, None, Some(prev_hop_chan_id));
5555
+ let logger = WithContext::from(&self.logger, None, Some(prev_hop_chan_id), Some(payment_hash) );
5556
5556
log_error!(logger, "Temporary failure claiming HTLC, treating as success: {}", err.err.err);
5557
5557
} else { errs.push((pk, err)); }
5558
5558
}
@@ -5704,7 +5704,7 @@ where
5704
5704
// with a preimage we *must* somehow manage to propagate it to the upstream
5705
5705
// channel, or we must have an ability to receive the same event and try
5706
5706
// again on restart.
5707
- log_error!(WithContext::from(&self.logger, None, Some(prev_hop.channel_id)),
5707
+ log_error!(WithContext::from(&self.logger, None, Some(prev_hop.channel_id), None ),
5708
5708
"Critical error: failed to update channel monitor with preimage {:?}: {:?}",
5709
5709
payment_preimage, update_res);
5710
5710
}
@@ -6084,7 +6084,7 @@ where
6084
6084
6085
6085
fn do_accept_inbound_channel(&self, temporary_channel_id: &ChannelId, counterparty_node_id: &PublicKey, accept_0conf: bool, user_channel_id: u128) -> Result<(), APIError> {
6086
6086
6087
- let logger = WithContext::from(&self.logger, Some(*counterparty_node_id), Some(*temporary_channel_id));
6087
+ let logger = WithContext::from(&self.logger, Some(*counterparty_node_id), Some(*temporary_channel_id), None );
6088
6088
let _persistence_guard = PersistenceNotifierGuard::notify_on_drop(self);
6089
6089
6090
6090
let peers_without_funded_channels =
@@ -6511,7 +6511,8 @@ where
6511
6511
let logger = WithContext::from(
6512
6512
&self.logger,
6513
6513
Some(chan.context.get_counterparty_node_id()),
6514
- Some(chan.context.channel_id())
6514
+ Some(chan.context.channel_id()),
6515
+ None
6515
6516
);
6516
6517
let res =
6517
6518
chan.funding_signed(&msg, best_block, &self.signer_provider, &&logger);
@@ -6722,7 +6723,7 @@ where
6722
6723
};
6723
6724
if let Some(broadcast_tx) = tx {
6724
6725
let channel_id = chan_option.as_ref().map(|channel| channel.context().channel_id());
6725
- log_info!(WithContext::from(&self.logger, Some(*counterparty_node_id), channel_id), "Broadcasting {}", log_tx!(broadcast_tx));
6726
+ log_info!(WithContext::from(&self.logger, Some(*counterparty_node_id), channel_id, None ), "Broadcasting {}", log_tx!(broadcast_tx));
6726
6727
self.tx_broadcaster.broadcast_transactions(&[&broadcast_tx]);
6727
6728
}
6728
6729
if let Some(ChannelPhase::Funded(chan)) = chan_option {
@@ -6995,7 +6996,7 @@ where
6995
6996
prev_short_channel_id, prev_funding_outpoint, prev_channel_id, prev_htlc_id, prev_user_channel_id, forward_info });
6996
6997
},
6997
6998
hash_map::Entry::Occupied(_) => {
6998
- let logger = WithContext::from(&self.logger, None, Some(prev_channel_id));
6999
+ let logger = WithContext::from(&self.logger, None, Some(prev_channel_id), Some(forward_info.payment_hash) );
6999
7000
log_info!(logger, "Failed to forward incoming HTLC: detected duplicate intercepted payment over short channel id {}", scid);
7000
7001
let htlc_source = HTLCSource::PreviousHopData(HTLCPreviousHopData {
7001
7002
short_channel_id: prev_short_channel_id,
@@ -7259,7 +7260,7 @@ where
7259
7260
msg.channel_id
7260
7261
)
7261
7262
})?;
7262
- let logger = WithContext::from(&self.logger, Some(*counterparty_node_id), Some(msg.channel_id));
7263
+ let logger = WithContext::from(&self.logger, Some(*counterparty_node_id), Some(msg.channel_id), None );
7263
7264
let mut peer_state_lock = peer_state_mutex.lock().unwrap();
7264
7265
let peer_state = &mut *peer_state_lock;
7265
7266
match peer_state.channel_by_id.entry(msg.channel_id) {
@@ -7361,7 +7362,7 @@ where
7361
7362
for monitor_event in monitor_events.drain(..) {
7362
7363
match monitor_event {
7363
7364
MonitorEvent::HTLCEvent(htlc_update) => {
7364
- let logger = WithContext::from(&self.logger, counterparty_node_id, Some(channel_id));
7365
+ let logger = WithContext::from(&self.logger, counterparty_node_id, Some(channel_id), Some(htlc_update.payment_hash) );
7365
7366
if let Some(preimage) = htlc_update.payment_preimage {
7366
7367
log_trace!(logger, "Claiming HTLC with preimage {} from our monitor", preimage);
7367
7368
self.claim_funds_internal(htlc_update.source, preimage,
@@ -8225,7 +8226,7 @@ where
8225
8226
mut completed_blocker: Option<RAAMonitorUpdateBlockingAction>) {
8226
8227
8227
8228
let logger = WithContext::from(
8228
- &self.logger, Some(counterparty_node_id), Some(channel_id),
8229
+ &self.logger, Some(counterparty_node_id), Some(channel_id), None
8229
8230
);
8230
8231
loop {
8231
8232
let per_peer_state = self.per_peer_state.read().unwrap();
@@ -8697,7 +8698,7 @@ where
8697
8698
HTLCFailReason::from_failure_code(0x2000 | 2),
8698
8699
HTLCDestination::InvalidForward { requested_forward_scid }));
8699
8700
let logger = WithContext::from(
8700
- &self.logger, None, Some(htlc.prev_channel_id)
8701
+ &self.logger, None, Some(htlc.prev_channel_id), Some(htlc.forward_info.payment_hash)
8701
8702
);
8702
8703
log_trace!(logger, "Timing out intercepted HTLC with requested forward scid {}", requested_forward_scid);
8703
8704
false
@@ -9007,7 +9008,7 @@ where
9007
9008
let mut per_peer_state = self.per_peer_state.write().unwrap();
9008
9009
let remove_peer = {
9009
9010
log_debug!(
9010
- WithContext::from(&self.logger, Some(*counterparty_node_id), None),
9011
+ WithContext::from(&self.logger, Some(*counterparty_node_id), None, None ),
9011
9012
"Marking channels with {} disconnected and generating channel_updates.",
9012
9013
log_pubkey!(counterparty_node_id)
9013
9014
);
@@ -9115,7 +9116,7 @@ where
9115
9116
}
9116
9117
9117
9118
fn peer_connected(&self, counterparty_node_id: &PublicKey, init_msg: &msgs::Init, inbound: bool) -> Result<(), ()> {
9118
- let logger = WithContext::from(&self.logger, Some(*counterparty_node_id), None);
9119
+ let logger = WithContext::from(&self.logger, Some(*counterparty_node_id), None, None );
9119
9120
if !init_msg.features.supports_static_remote_key() {
9120
9121
log_debug!(logger, "Peer {} does not support static remote key, disconnecting", log_pubkey!(counterparty_node_id));
9121
9122
return Err(());
@@ -10904,7 +10905,7 @@ where
10904
10905
if let Some(in_flight_upds) = in_flight_monitor_updates {
10905
10906
for ((counterparty_id, funding_txo), mut chan_in_flight_updates) in in_flight_upds {
10906
10907
let channel_id = funding_txo_to_channel_id.get(&funding_txo).copied();
10907
- let logger = WithContext::from(&args.logger, Some(counterparty_id), channel_id);
10908
+ let logger = WithContext::from(&args.logger, Some(counterparty_id), channel_id, None );
10908
10909
if let Some(monitor) = args.channel_monitors.get(&funding_txo) {
10909
10910
// Now that we've removed all the in-flight monitor updates for channels that are
10910
10911
// still open, we need to replay any monitor updates that are for closed channels,
@@ -11268,7 +11269,7 @@ where
11268
11269
for (node_id, monitor_update_blocked_actions) in monitor_update_blocked_actions_per_peer.unwrap() {
11269
11270
if let Some(peer_state) = per_peer_state.get(&node_id) {
11270
11271
for (channel_id, actions) in monitor_update_blocked_actions.iter() {
11271
- let logger = WithContext::from(&args.logger, Some(node_id), Some(*channel_id));
11272
+ let logger = WithContext::from(&args.logger, Some(node_id), Some(*channel_id), None );
11272
11273
for action in actions.iter() {
11273
11274
if let MonitorUpdateCompletionAction::EmitEventAndFreeOtherChannel {
11274
11275
downstream_counterparty_and_funding_outpoint:
@@ -11296,7 +11297,7 @@ where
11296
11297
}
11297
11298
peer_state.lock().unwrap().monitor_update_blocked_actions = monitor_update_blocked_actions;
11298
11299
} else {
11299
- log_error!(WithContext::from(&args.logger, Some(node_id), None), "Got blocked actions without a per-peer-state for {}", node_id);
11300
+ log_error!(WithContext::from(&args.logger, Some(node_id), None, None ), "Got blocked actions without a per-peer-state for {}", node_id);
11300
11301
return Err(DecodeError::InvalidValue);
11301
11302
}
11302
11303
}
0 commit comments