#[inline]
/// Creates a set of keys for build_commitment_transaction to generate a transaction which we
/// will sign and send to our counterparty.
+ /// If an Err is returned, it is a ChannelError::Close (for get_outbound_funding_created)
fn build_remote_transaction_keys(&self) -> Result<TxCreationKeys, ChannelError> {
//TODO: Ensure that the payment_key derived here ends up in the library users' wallet as we
//may see payments to it!
}
}
+ /// If an Err is returned, it is a ChannelError::Close (for get_outbound_funding_created)
fn get_outbound_funding_created_signature(&mut self) -> Result<(Signature, Transaction), ChannelError> {
let funding_script = self.get_funding_redeemscript();
/// or if called on an inbound channel.
/// Note that channel_id changes during this call!
/// Do NOT broadcast the funding transaction until after a successful funding_signed call!
+ /// If an Err is returned, it is a ChannelError::Close.
pub fn get_outbound_funding_created(&mut self, funding_txo: OutPoint) -> Result<(msgs::FundingCreated, ChannelMonitor), ChannelError> {
if !self.channel_outbound {
panic!("Tried to create outbound funding_created message on an inbound channel!");
shutdown_finish: None,
}
}
- #[inline]
- fn from_chan_maybe_close(err: ChannelError, channel_id: [u8; 32]) -> Self {
- Self {
- err: match err {
- ChannelError::Ignore(msg) => HandleError {
- err: msg,
- action: Some(msgs::ErrorAction::IgnoreError),
- },
- ChannelError::Close(msg) => HandleError {
- err: msg,
- action: Some(msgs::ErrorAction::SendErrorMessage {
- msg: msgs::ErrorMessage {
- channel_id,
- data: msg.to_string()
- },
- }),
- },
- },
- needs_channel_force_close: true,
- shutdown_finish: None,
- }
- }
}
/// Pass to fail_htlc_backwwards to indicate the reason to fail the payment
match channel_state.by_id.remove(temporary_channel_id) {
Some(mut chan) => {
(chan.get_outbound_funding_created(funding_txo)
- .map_err(|e| MsgHandleErrInternal::from_chan_maybe_close(e, chan.channel_id()))
+ .map_err(|e| if let ChannelError::Close(msg) = e {
+ MsgHandleErrInternal::from_finish_shutdown(msg, chan.channel_id(), chan.force_shutdown(), None)
+ } else { unreachable!(); })
, chan)
},
None => return