@@ -6008,7 +6008,12 @@ where
6008
6008
self.peers_without_funded_channels(|peer| { peer.total_channel_count() > 0 });
6009
6009
let per_peer_state = self.per_peer_state.read().unwrap();
6010
6010
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) })?;
6011
+ .ok_or_else(|| {
6012
+ let err_str = format!("Can't find a peer matching the passed counterparty node_id {}", counterparty_node_id);
6013
+ log_error!(self.logger, "{}", err_str);
6014
+
6015
+ APIError::ChannelUnavailable { err: err_str }
6016
+ })?;
6012
6017
let mut peer_state_lock = peer_state_mutex.lock().unwrap();
6013
6018
let peer_state = &mut *peer_state_lock;
6014
6019
let is_only_peer_channel = peer_state.total_channel_count() == 1;
@@ -6023,9 +6028,19 @@ where
6023
6028
InboundV1Channel::new(&self.fee_estimator, &self.entropy_source, &self.signer_provider,
6024
6029
counterparty_node_id.clone(), &self.channel_type_features(), &peer_state.latest_features,
6025
6030
&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() })
6031
+ &self.logger, accept_0conf).map_err(|e| {
6032
+ let err_str = e.to_string();
6033
+ log_error!(self.logger,e);
6034
+
6035
+ APIError::ChannelUnavailable { err: err_str }
6036
+ })
6037
+ }
6038
+ _ => {
6039
+ let err_str = "No such channel awaiting to be accepted.".to_owned();
6040
+ log_error!(self.logger, "{}", err_str);
6041
+
6042
+ Err(APIError::APIMisuseError { err: err_str })
6027
6043
}
6028
- _ => Err(APIError::APIMisuseError { err: "No such channel awaiting to be accepted.".to_owned() })
6029
6044
}?;
6030
6045
6031
6046
if accept_0conf {
@@ -6039,7 +6054,10 @@ where
6039
6054
}
6040
6055
};
6041
6056
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() });
6057
+ let err_str = "Please use accept_inbound_channel_from_trusted_peer_0conf to accept channels with zero confirmations.".to_owned();
6058
+ log_error!(self.logger, "{}", err_str);
6059
+
6060
+ return Err(APIError::APIMisuseError { err: err_str });
6043
6061
} else {
6044
6062
// If this peer already has some channels, a new channel won't increase our number of peers
6045
6063
// with unfunded channels, so as long as we aren't over the maximum number of unfunded
@@ -6052,7 +6070,10 @@ where
6052
6070
}
6053
6071
};
6054
6072
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() });
6073
+ let err_str = "Too many peers with unfunded channels, refusing to accept new ones".to_owned();
6074
+ log_error!(self.logger, "{}", err_str);
6075
+
6076
+ return Err(APIError::APIMisuseError { err: err_str });
6056
6077
}
6057
6078
}
6058
6079
0 commit comments