@@ -6002,13 +6002,20 @@ where
6002
6002
}
6003
6003
6004
6004
fn do_accept_inbound_channel(&self, temporary_channel_id: &ChannelId, counterparty_node_id: &PublicKey, accept_0conf: bool, user_channel_id: u128) -> Result<(), APIError> {
6005
+
6006
+ let logger = WithContext::from(&self.logger, Some(*counterparty_node_id), Some(*temporary_channel_id));
6005
6007
let _persistence_guard = PersistenceNotifierGuard::notify_on_drop(self);
6006
6008
6007
6009
let peers_without_funded_channels =
6008
6010
self.peers_without_funded_channels(|peer| { peer.total_channel_count() > 0 });
6009
6011
let per_peer_state = self.per_peer_state.read().unwrap();
6010
6012
let peer_state_mutex = per_peer_state.get(counterparty_node_id)
6011
- .ok_or_else(|| APIError::ChannelUnavailable { err: format!("Can't find a peer matching the passed counterparty node_id {}", counterparty_node_id) })?;
6013
+ .ok_or_else(|| {
6014
+ let err_str = format!("Can't find a peer matching the passed counterparty node_id {}", counterparty_node_id);
6015
+ log_error!(logger, "{}", err_str);
6016
+
6017
+ APIError::ChannelUnavailable { err: err_str }
6018
+ })?;
6012
6019
let mut peer_state_lock = peer_state_mutex.lock().unwrap();
6013
6020
let peer_state = &mut *peer_state_lock;
6014
6021
let is_only_peer_channel = peer_state.total_channel_count() == 1;
@@ -6023,9 +6030,19 @@ where
6023
6030
InboundV1Channel::new(&self.fee_estimator, &self.entropy_source, &self.signer_provider,
6024
6031
counterparty_node_id.clone(), &self.channel_type_features(), &peer_state.latest_features,
6025
6032
&unaccepted_channel.open_channel_msg, user_channel_id, &self.default_configuration, best_block_height,
6026
- &self.logger, accept_0conf).map_err(|e| APIError::ChannelUnavailable { err: e.to_string() })
6033
+ &self.logger, accept_0conf).map_err(|e| {
6034
+ let err_str = e.to_string();
6035
+ log_error!(logger, "{}", err_str);
6036
+
6037
+ APIError::ChannelUnavailable { err: err_str }
6038
+ })
6039
+ }
6040
+ _ => {
6041
+ let err_str = "No such channel awaiting to be accepted.".to_owned();
6042
+ log_error!(logger, "{}", err_str);
6043
+
6044
+ Err(APIError::APIMisuseError { err: err_str })
6027
6045
}
6028
- _ => Err(APIError::APIMisuseError { err: "No such channel awaiting to be accepted.".to_owned() })
6029
6046
}?;
6030
6047
6031
6048
if accept_0conf {
@@ -6039,7 +6056,10 @@ where
6039
6056
}
6040
6057
};
6041
6058
peer_state.pending_msg_events.push(send_msg_err_event);
6042
- return Err(APIError::APIMisuseError { err: "Please use accept_inbound_channel_from_trusted_peer_0conf to accept channels with zero confirmations.".to_owned() });
6059
+ let err_str = "Please use accept_inbound_channel_from_trusted_peer_0conf to accept channels with zero confirmations.".to_owned();
6060
+ log_error!(logger, "{}", err_str);
6061
+
6062
+ return Err(APIError::APIMisuseError { err: err_str });
6043
6063
} else {
6044
6064
// If this peer already has some channels, a new channel won't increase our number of peers
6045
6065
// with unfunded channels, so as long as we aren't over the maximum number of unfunded
@@ -6052,7 +6072,10 @@ where
6052
6072
}
6053
6073
};
6054
6074
peer_state.pending_msg_events.push(send_msg_err_event);
6055
- return Err(APIError::APIMisuseError { err: "Too many peers with unfunded channels, refusing to accept new ones".to_owned() });
6075
+ let err_str = "Too many peers with unfunded channels, refusing to accept new ones".to_owned();
6076
+ log_error!(logger, "{}", err_str);
6077
+
6078
+ return Err(APIError::APIMisuseError { err: err_str });
6056
6079
}
6057
6080
}
6058
6081
0 commit comments