You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Decide on close-broadcasting commitment txn based on channel state
In a previous commit, we removed the ability for users to pick
whether we will broadcast a commitment transaction on channel
closure. However, that doesn't mean that there is no value in never
broadcasting commitment transactions on channel closure. Rather, we
use it to avoid broadcasting transactions which we know cannot
confirm if the channel's funding transaction was not broadcasted.
Here we make this relationship more formal by splitting the
force-closure handling logic in `Channel` into the existing
`ChannelContext::force_shutdown` as well as a new
`ChannelContext::abandon_unfunded_chan`.
`ChannelContext::force_shutdown` is the only public method, but it
delegates to `abandon_unfunded_chan` based on the channel's state.
This has the nice side effect of avoiding commitment transaction
broadcasting when a batch open fails to get past the funding stage.
let chan_err = ChannelError::close(err.to_owned());
5577
5579
let api_err = APIError::APIMisuseError { err: err.to_owned() };
5578
-
return close_chan!(chan_err, api_err, chan);
5580
+
return abandon_chan!(chan_err, api_err, chan);
5579
5581
},
5580
5582
}
5581
5583
@@ -5585,7 +5587,7 @@ where
5585
5587
Ok(funding_msg) => (chan, funding_msg),
5586
5588
Err((mut chan, chan_err)) => {
5587
5589
let api_err = APIError::ChannelUnavailable { err: "Signer refused to sign the initial commitment transaction".to_owned() };
5588
-
return close_chan!(chan_err, api_err, chan);
5590
+
return abandon_chan!(chan_err, api_err, chan);
5589
5591
}
5590
5592
}
5591
5593
},
@@ -5614,7 +5616,7 @@ where
5614
5616
let chan_err = ChannelError::close(err.to_owned());
5615
5617
let api_err = APIError::APIMisuseError { err: err.to_owned() };
5616
5618
chan.unset_funding_info();
5617
-
return close_chan!(chan_err, api_err, chan);
5619
+
return abandon_chan!(chan_err, api_err, chan);
5618
5620
},
5619
5621
hash_map::Entry::Vacant(e) => {
5620
5622
if let Some(msg) = msg_opt {
@@ -14632,7 +14634,7 @@ where
14632
14634
log_error!(logger, " The ChannelMonitor for channel {} is at counterparty commitment transaction number {} but the ChannelManager is at counterparty commitment transaction number {}.",
0 commit comments