close: accept wrong_funding outpoint arg if we negotiated the feature.

Changelog-Added: lightningd: experimental-shutdown-wrong-funding to allow remote nodes to close incorrectly opened channels.
Changelog-Added: JSON-RPC: close has a new `wrong_funding` option to try to close out unused channels where we messed up the funding tx.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2021-03-16 06:56:12 +10:30
parent 1cfb7b84d0
commit b62706aa01
11 changed files with 146 additions and 22 deletions

16
doc/lightning-close.7 generated
View File

@@ -3,7 +3,7 @@
lightning-close - Command for closing channels with direct peers
.SH SYNOPSIS
\fBclose\fR \fIid\fR [\fIunilateraltimeout\fR] [\fIdestination\fR] [\fIfee_negotiation_step\fR]
\fBclose\fR \fIid\fR [\fIunilateraltimeout\fR] [\fIdestination\fR] [\fIfee_negotiation_step\fR] [\fIwrong_funding\\\fR]
.SH DESCRIPTION
@@ -54,6 +54,16 @@ The default is "50%"\.
.RE
\fIwrong_funding_txid\fR can only be specified if both sides have offered
the "shutdown_wrong_funding" feature (enabled by the
\fBexperimental-shutdown-wrong-funding\fR option): it must be a
transaction id followed by a colon then the output number\. Instead of
negotiating a shutdown to spend the expected funding transaction, the
shutdown transaction will spend this output instead\. This is only
allowed if this peer opened the channel and the channel is unused: it
can rescue openings which have been manually miscreated\.
The peer needs to be live and connected in order to negotiate a mutual
close\. The default of unilaterally closing after 48 hours is usually a
reasonable indication that you can no longer contact the peer\.
@@ -95,10 +105,10 @@ ZmnSCPxj \fI<ZmnSCPxj@protonmail.com\fR> is mainly responsible\.
.SH SEE ALSO
\fBlightning-disconnect\fR(7), \fBlightning-fundchannel\fR(7)
\fBlightning-disconnect\fR(7), \fBlightning-fundchannel\fR(7), \fBlightningd-config\fR(5)\.
.SH RESOURCES
Main web site: \fIhttps://github.com/ElementsProject/lightning\fR
\" SHA256STAMP:d16e185f9a781f23987dfb65aaa1eae8dab19796975433c69e16f1f6b18751c5
\" SHA256STAMP:f835c6a11e0df5610761e858e78783f9f99d530b8d2a6bedaf6f301eccdc31e0

View File

@@ -4,7 +4,7 @@ lightning-close -- Command for closing channels with direct peers
SYNOPSIS
--------
**close** *id* \[*unilateraltimeout*\] \[*destination*\] \[*fee_negotiation_step*\]
**close** *id* \[*unilateraltimeout*\] \[*destination*\] \[*fee_negotiation_step*\] \[*wrong_funding\*]
DESCRIPTION
-----------
@@ -44,6 +44,15 @@ insist on our fee as much as possible.
we quickly accept the peer's proposal.
The default is "50%".
*wrong_funding_txid* can only be specified if both sides have offered
the "shutdown_wrong_funding" feature (enabled by the
**experimental-shutdown-wrong-funding** option): it must be a
transaction id followed by a colon then the output number. Instead of
negotiating a shutdown to spend the expected funding transaction, the
shutdown transaction will spend this output instead. This is only
allowed if this peer opened the channel and the channel is unused: it
can rescue openings which have been manually miscreated.
The peer needs to be live and connected in order to negotiate a mutual
close. The default of unilaterally closing after 48 hours is usually a
reasonable indication that you can no longer contact the peer.
@@ -87,7 +96,7 @@ ZmnSCPxj <<ZmnSCPxj@protonmail.com>> is mainly responsible.
SEE ALSO
--------
lightning-disconnect(7), lightning-fundchannel(7)
lightning-disconnect(7), lightning-fundchannel(7), lightningd-config(5).
RESOURCES
---------

View File

@@ -588,9 +588,9 @@ This usually requires \fBexperimental-onion-messages\fR as well\. See
Specifying this allows the \fBwrong_funding\fR field in shutdown: if a
remote node has opened a channel using the incorrect txid (and it
hasn't been used yet at all) this allows them to negotiate a clean
shutdown with the txid they offer\.
remote node has opened a channel but claims it used the incorrect txid
(and the channel hasn't been used yet at all) this allows them to
negotiate a clean shutdown with the txid they offer\.
.SH BUGS
@@ -617,4 +617,4 @@ Main web site: \fIhttps://github.com/ElementsProject/lightning\fR
Note: the modules in the ccan/ directory have their own licenses, but
the rest of the code is covered by the BSD-style MIT license\.
\" SHA256STAMP:ecfd7ac60b50a20cad39dfa0e423e4885256a94658b5886f577df50773555e7e
\" SHA256STAMP:b0cdc467650b05758f90f2523ab8b45e526ac818e426cb2c2bc42cb98673e373

View File

@@ -486,9 +486,9 @@ lightning-offer(7) and lightning-fetchinvoice(7).
**experimental-shutdown-wrong-funding**
Specifying this allows the `wrong_funding` field in shutdown: if a
remote node has opened a channel using the incorrect txid (and it
hasn't been used yet at all) this allows them to negotiate a clean
shutdown with the txid they offer.
remote node has opened a channel but claims it used the incorrect txid
(and the channel hasn't been used yet at all) this allows them to
negotiate a clean shutdown with the txid they offer.
BUGS
----