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
Force-close channels on reorg only if the funding is unconfirmed
Currently, if a channel's funding is locked in and then later
reorg'd back to half of the channel's minimum-depth we will
immediately force-close the channel. However, this can happen at
the fork-point while processing a reorg, and generally reorgs do
not reduce the block height at all, making this a rather useless
endeavor.
Ideally we'd never auto-force-close channels at all due to a reorg,
instead simply marking it as inactive until the funding
transaction is re-confirmed (or allowing the user to attempt to
force-close or force-closing once we're confident we have
completed reorg processing if we're at risk of losing funds
already received in the channel).
Sadly, we currently do not support changing a channel's SCID and
updating our SCID maps, so we cannot yet remove the automated
force-close logic. Still, there is no reason to do it until a
funding transaction has been removed from the chain.
This implements that change - only force-closeing once a channel's
funding transaction has been reorg'd out (still potentially at a
reorg's fork point). This continues to imply a 1-confirmation
channel will always be force-closed after a reorg of the funding
transaction, and will imply a similar behavior with 0-conf
channels.
if connect_style == ConnectStyle::FullBlockViaListen && !use_funding_unconfirmed {
216
-
handle_announce_close_broadcast_events(&nodes,0,1,true,"Channel closed because of an exception: Funding transaction was un-confirmed. Locked at 6 confs, now have 2 confs.");
217
-
}else{
218
-
handle_announce_close_broadcast_events(&nodes,0,1,true,"Channel closed because of an exception: Funding transaction was un-confirmed. Locked at 6 confs, now have 0 confs.");
219
-
}
215
+
handle_announce_close_broadcast_events(&nodes,0,1,true,"Channel closed because of an exception: Funding transaction was un-confirmed. Locked at 6 confs, now have 0 confs.");
220
216
check_added_monitors!(nodes[1],1);
221
217
{
222
218
let channel_state = nodes[0].node.channel_state.lock().unwrap();
if connect_style == ConnectStyle::FullBlockViaListen && !use_funding_unconfirmed {
284
-
handle_announce_close_broadcast_events(&nodes,0,1,true,"Channel closed because of an exception: Funding transaction was un-confirmed. Locked at 6 confs, now have 2 confs.");
285
-
}else{
286
-
handle_announce_close_broadcast_events(&nodes,0,1,true,"Channel closed because of an exception: Funding transaction was un-confirmed. Locked at 6 confs, now have 0 confs.");
287
-
}
279
+
handle_announce_close_broadcast_events(&nodes,0,1,true,"Channel closed because of an exception: Funding transaction was un-confirmed. Locked at 6 confs, now have 0 confs.");
288
280
check_added_monitors!(nodes[1],1);
289
281
{
290
282
let channel_state = nodes[0].node.channel_state.lock().unwrap();
nodes[0].node.test_process_background_events();// Required to free the pending background monitor update
299
291
check_added_monitors!(nodes[0],1);
300
-
let expected_err = if connect_style == ConnectStyle::FullBlockViaListen && !use_funding_unconfirmed {
301
-
"Funding transaction was un-confirmed. Locked at 6 confs, now have 2 confs."
302
-
}else{
303
-
"Funding transaction was un-confirmed. Locked at 6 confs, now have 0 confs."
304
-
};
292
+
let expected_err = "Funding transaction was un-confirmed. Locked at 6 confs, now have 0 confs.";
305
293
check_closed_event!(nodes[1],1,ClosureReason::CounterpartyForceClosed{ peer_msg:"Channel closed because of an exception: ".to_owned() + expected_err });
0 commit comments