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());
5548
5550
let api_err = APIError::APIMisuseError { err: err.to_owned() };
5549
-
return close_chan!(chan_err, api_err, chan);
5551
+
return abandon_chan!(chan_err, api_err, chan);
5550
5552
},
5551
5553
}
5552
5554
@@ -5556,7 +5558,7 @@ where
5556
5558
Ok(funding_msg) => (chan, funding_msg),
5557
5559
Err((mut chan, chan_err)) => {
5558
5560
let api_err = APIError::ChannelUnavailable { err: "Signer refused to sign the initial commitment transaction".to_owned() };
5559
-
return close_chan!(chan_err, api_err, chan);
5561
+
return abandon_chan!(chan_err, api_err, chan);
5560
5562
}
5561
5563
}
5562
5564
},
@@ -5585,7 +5587,7 @@ where
5585
5587
let chan_err = ChannelError::close(err.to_owned());
5586
5588
let api_err = APIError::APIMisuseError { err: err.to_owned() };
5587
5589
chan.unset_funding_info();
5588
-
return close_chan!(chan_err, api_err, chan);
5590
+
return abandon_chan!(chan_err, api_err, chan);
5589
5591
},
5590
5592
hash_map::Entry::Vacant(e) => {
5591
5593
if let Some(msg) = msg_opt {
@@ -14494,7 +14496,7 @@ where
14494
14496
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