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());
5574
5576
let api_err = APIError::APIMisuseError { err: err.to_owned() };
5575
-
return close_chan!(chan_err, api_err, chan);
5577
+
return abandon_chan!(chan_err, api_err, chan);
5576
5578
},
5577
5579
}
5578
5580
@@ -5582,7 +5584,7 @@ where
5582
5584
Ok(funding_msg) => (chan, funding_msg),
5583
5585
Err((mut chan, chan_err)) => {
5584
5586
let api_err = APIError::ChannelUnavailable { err: "Signer refused to sign the initial commitment transaction".to_owned() };
5585
-
return close_chan!(chan_err, api_err, chan);
5587
+
return abandon_chan!(chan_err, api_err, chan);
5586
5588
}
5587
5589
}
5588
5590
},
@@ -5611,7 +5613,7 @@ where
5611
5613
let chan_err = ChannelError::close(err.to_owned());
5612
5614
let api_err = APIError::APIMisuseError { err: err.to_owned() };
5613
5615
chan.unset_funding_info();
5614
-
return close_chan!(chan_err, api_err, chan);
5616
+
return abandon_chan!(chan_err, api_err, chan);
5615
5617
},
5616
5618
hash_map::Entry::Vacant(e) => {
5617
5619
if let Some(msg) = msg_opt {
@@ -14629,7 +14631,7 @@ where
14629
14631
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