close: spec is final, it's not experimental.

That was quick!

We remove the 50% test, since the default is now to use quickclose.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Added: Protocol: We now perform quick-close if the peer supports it.
This commit is contained in:
Rusty Russell 2021-09-08 14:11:46 +09:30
parent 6ee8c40b29
commit 84957be410
12 changed files with 14 additions and 70 deletions

11
doc/lightning-close.7 generated
View file

@ -35,9 +35,7 @@ friends to upgrade!
The \fIfee_negotiation_step\fR parameter controls how closing fee The \fIfee_negotiation_step\fR parameter controls how closing fee
negotiation is performed assuming the peer proposes a fee that is negotiation is performed assuming the peer proposes a fee that is
different than our estimate\. (Note that using this option different than our estimate\. (Note that modern peers use the quick-close protocol which does not allow negotiation: see \fIfeerange\fR instead)\.
prevents \fBexperimental-quick-close\fR, as the quick-close protocol
does not allow negotiation)\.
On every negotiation step we must give up On every negotiation step we must give up
@ -80,8 +78,9 @@ unless this flag is passed in\. Defaults to false\.
\fIfeerange\fR is an optional array [ \fImin\fR, \fImax\fR ], indicating the \fIfeerange\fR is an optional array [ \fImin\fR, \fImax\fR ], indicating the
minimum and maximum feerates to offer\. \fIslow\fR and \fIunilateral_close\fR minimum and maximum feerates to offer: the peer will obey these if it
are the defaults\. supports the quick-close protocol\. \fIslow\fR and \fIunilateral_close\fR are
the defaults\.
Rates are one of the strings \fIurgent\fR (aim for next block), \fInormal\fR Rates are one of the strings \fIurgent\fR (aim for next block), \fInormal\fR
@ -155,4 +154,4 @@ ZmnSCPxj \fI<ZmnSCPxj@protonmail.com\fR> is mainly responsible\.
Main web site: \fIhttps://github.com/ElementsProject/lightning\fR Main web site: \fIhttps://github.com/ElementsProject/lightning\fR
\" SHA256STAMP:94359c9d63107e5558c7f9cec137899a057f2d172df08f4a78de8fe09defb440 \" SHA256STAMP:1182e596ddf208f37d269e37b06e30199b8d6b6bc1373d92096557c20ad437ac

View file

@ -33,9 +33,7 @@ friends to upgrade!
The *fee_negotiation_step* parameter controls how closing fee The *fee_negotiation_step* parameter controls how closing fee
negotiation is performed assuming the peer proposes a fee that is negotiation is performed assuming the peer proposes a fee that is
different than our estimate. (Note that using this option different than our estimate. (Note that modern peers use the quick-close protocol which does not allow negotiation: see *feerange* instead).
prevents **experimental-quick-close**, as the quick-close protocol
does not allow negotiation).
On every negotiation step we must give up On every negotiation step we must give up
some amount from our proposal towards the peer's proposal. This parameter some amount from our proposal towards the peer's proposal. This parameter
@ -65,10 +63,10 @@ can rescue openings which have been manually miscreated.
(option_will_fund), we prevent initiation of a mutual close (option_will_fund), we prevent initiation of a mutual close
unless this flag is passed in. Defaults to false. unless this flag is passed in. Defaults to false.
*feerange* is an optional array [ *min*, *max* ], indicating the *feerange* is an optional array [ *min*, *max* ], indicating the
minimum and maximum feerates to offer. *slow* and *unilateral_close* minimum and maximum feerates to offer: the peer will obey these if it
are the defaults. supports the quick-close protocol. *slow* and *unilateral_close* are
the defaults.
Rates are one of the strings *urgent* (aim for next block), *normal* Rates are one of the strings *urgent* (aim for next block), *normal*
(next 4 blocks or so) or *slow* (next 100 blocks or so) to use (next 4 blocks or so) or *slow* (next 100 blocks or so) to use

View file

@ -90,8 +90,6 @@ On success, an object is returned, containing:
.IP \[bu] .IP \[bu]
\fBexperimental-offers\fR (boolean, optional): \fBexperimental-offers\fR field from config or cmdline, or default \fBexperimental-offers\fR (boolean, optional): \fBexperimental-offers\fR field from config or cmdline, or default
.IP \[bu] .IP \[bu]
\fBexperimental-quick-close\fR (boolean, optional): \fBexperimental-quick-close\fR field from config or cmdline, or default
.IP \[bu]
\fBexperimental-shutdown-wrong-funding\fR (boolean, optional): \fBexperimental-shutdown-wrong-funding\fR field from config or cmdline, or default \fBexperimental-shutdown-wrong-funding\fR (boolean, optional): \fBexperimental-shutdown-wrong-funding\fR field from config or cmdline, or default
.IP \[bu] .IP \[bu]
\fBrgb\fR (hex, optional): \fBrgb\fR field from config or cmdline, or default (always 6 characters) \fBrgb\fR (hex, optional): \fBrgb\fR field from config or cmdline, or default (always 6 characters)
@ -272,4 +270,4 @@ Vincenzo Palazzo \fI<vincenzo.palazzo@protonmail.com\fR> wrote the initial versi
Main web site: \fIhttps://github.com/ElementsProject/lightning\fR Main web site: \fIhttps://github.com/ElementsProject/lightning\fR
\" SHA256STAMP:fd8f2ae862627712b6baf51741670a6d60db8342f839580871617deed0c75317 \" SHA256STAMP:b6e48314de5642ec61a3e2c989ac0197630c2a3c0e8e6d86020b597679049400

View file

@ -55,7 +55,6 @@ On success, an object is returned, containing:
- **experimental-dual-fund** (boolean, optional): `experimental-dual-fund` field from config or cmdline, or default - **experimental-dual-fund** (boolean, optional): `experimental-dual-fund` field from config or cmdline, or default
- **experimental-onion-messages** (boolean, optional): `experimental-onion-messages` field from config or cmdline, or default - **experimental-onion-messages** (boolean, optional): `experimental-onion-messages` field from config or cmdline, or default
- **experimental-offers** (boolean, optional): `experimental-offers` field from config or cmdline, or default - **experimental-offers** (boolean, optional): `experimental-offers` field from config or cmdline, or default
- **experimental-quick-close** (boolean, optional): `experimental-quick-close` field from config or cmdline, or default
- **experimental-shutdown-wrong-funding** (boolean, optional): `experimental-shutdown-wrong-funding` field from config or cmdline, or default - **experimental-shutdown-wrong-funding** (boolean, optional): `experimental-shutdown-wrong-funding` field from config or cmdline, or default
- **rgb** (hex, optional): `rgb` field from config or cmdline, or default (always 6 characters) - **rgb** (hex, optional): `rgb` field from config or cmdline, or default (always 6 characters)
- **alias** (string, optional): `alias` field from config or cmdline, or default - **alias** (string, optional): `alias` field from config or cmdline, or default
@ -206,4 +205,4 @@ RESOURCES
--------- ---------
Main web site: <https://github.com/ElementsProject/lightning> Main web site: <https://github.com/ElementsProject/lightning>
[comment]: # ( SHA256STAMP:8b198154e70e1c0acb6c9ccdbe9e41e35ddab55738be9ea9076c5384da965cb8) [comment]: # ( SHA256STAMP:7bb40fc8fac201b32d9701b02596d0fa59eb14a3baf606439cbf96dc11548ed4)

View file

@ -625,16 +625,6 @@ about whether to add funds or not to a proposed channel is handled
automatically by a plugin that implements the appropriate logic for automatically by a plugin that implements the appropriate logic for
your needs\. The default behavior is to not contribute funds\. your needs\. The default behavior is to not contribute funds\.
\fBexperimental-quick-close\fR
Specifying this means we send our range of acceptable fees to the peer
on mutual close\. If they support it too, we'll simply use that for
closing (unless \fIfee_negotiation_step\fR is set, see \fBlightning-close\fR(7))\.
We always use this on channels which negotiation \fBoption_anchor_outputs\fR,
as the spec requires that\.
.SH BUGS .SH BUGS
You should report bugs on our github issues page, and maybe submit a fix You should report bugs on our github issues page, and maybe submit a fix
@ -660,4 +650,4 @@ Main web site: \fIhttps://github.com/ElementsProject/lightning\fR
Note: the modules in the ccan/ directory have their own licenses, but 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\. the rest of the code is covered by the BSD-style MIT license\.
\" SHA256STAMP:0d2474276b325cb002191211fb1d0da2409ebc859ff3ccc6dd3e688b10d4550c \" SHA256STAMP:1c392f3fee66dc6c1fc2c34200204a9be1d79e53fd5fb1720ad169fc671f71c0

View file

@ -517,14 +517,6 @@ about whether to add funds or not to a proposed channel is handled
automatically by a plugin that implements the appropriate logic for automatically by a plugin that implements the appropriate logic for
your needs. The default behavior is to not contribute funds. your needs. The default behavior is to not contribute funds.
**experimental-quick-close**
Specifying this means we send our range of acceptable fees to the peer
on mutual close. If they support it too, we'll simply use that for
closing (unless *fee_negotiation_step* is set, see lightning-close(7)).
We always use this on channels which negotiation `option_anchor_outputs`,
as the spec requires that.
BUGS BUGS
---- ----

View file

@ -117,10 +117,6 @@
"type": "boolean", "type": "boolean",
"description": "`experimental-offers` field from config or cmdline, or default" "description": "`experimental-offers` field from config or cmdline, or default"
}, },
"experimental-quick-close": {
"type": "boolean",
"description": "`experimental-quick-close` field from config or cmdline, or default"
},
"experimental-shutdown-wrong-funding": { "experimental-shutdown-wrong-funding": {
"type": "boolean", "type": "boolean",
"description": "`experimental-shutdown-wrong-funding` field from config or cmdline, or default" "description": "`experimental-shutdown-wrong-funding` field from config or cmdline, or default"

View file

@ -312,9 +312,8 @@ void peer_start_closingd(struct channel *channel,
channel->shutdown_scriptpubkey[REMOTE], channel->shutdown_scriptpubkey[REMOTE],
channel->closing_fee_negotiation_step, channel->closing_fee_negotiation_step,
channel->closing_fee_negotiation_step_unit, channel->closing_fee_negotiation_step_unit,
(ld->use_quickclose
/* Don't quickclose if they specified how to negotiate! */ /* Don't quickclose if they specified how to negotiate! */
&& channel->closing_fee_negotiation_step == 50 (channel->closing_fee_negotiation_step == 50
&& channel->closing_fee_negotiation_step_unit == CLOSING_FEE_NEGOTIATION_STEP_UNIT_PERCENTAGE) && channel->closing_fee_negotiation_step_unit == CLOSING_FEE_NEGOTIATION_STEP_UNIT_PERCENTAGE)
/* Always use quickclose with anchors */ /* Always use quickclose with anchors */
|| channel->option_anchor_outputs, || channel->option_anchor_outputs,

View file

@ -295,11 +295,6 @@ static struct lightningd *new_lightningd(const tal_t *ctx)
* case this is a pointer to an enum feerate-indexed array of values */ * case this is a pointer to an enum feerate-indexed array of values */
ld->force_feerates = NULL; ld->force_feerates = NULL;
/*~ We don't enable new network features until they've been approved
* and tested in the spec (i.e. some other implementation has also
* implemented and tested!). Until then we use a flag: */
ld->use_quickclose = false;
return ld; return ld;
} }

View file

@ -283,9 +283,6 @@ struct lightningd {
/* Should we re-exec ourselves instead of just exiting? */ /* Should we re-exec ourselves instead of just exiting? */
bool try_reexec; bool try_reexec;
/* --experimental-quick-close */
bool use_quickclose;
/* Array of (even) TLV types that we should allow. This is required /* Array of (even) TLV types that we should allow. This is required
* since we otherwise would outright reject them. */ * since we otherwise would outright reject them. */
u64 *accept_extra_tlv_types; u64 *accept_extra_tlv_types;

View file

@ -1062,10 +1062,6 @@ static void register_opts(struct lightningd *ld)
"--subdaemon=hsmd:remote_signer " "--subdaemon=hsmd:remote_signer "
"would use a hypothetical remote signing subdaemon."); "would use a hypothetical remote signing subdaemon.");
opt_register_noarg("--experimental-quick-close",
opt_set_bool, &ld->use_quickclose,
"EXPERIMENTAL: offer range to mutual close");
opt_register_logging(ld); opt_register_logging(ld);
opt_register_version(); opt_register_version();

View file

@ -461,21 +461,6 @@ def test_closing_negotiation_step_30pct(node_factory, bitcoind, chainparams):
closing_negotiation_step(node_factory, bitcoind, chainparams, opts) closing_negotiation_step(node_factory, bitcoind, chainparams, opts)
@unittest.skipIf(EXPERIMENTAL_FEATURES, "anchors uses quick-close, not negotiation")
def test_closing_negotiation_step_50pct(node_factory, bitcoind, chainparams):
"""Test that the closing fee negotiation step works, 50%, the default"""
opts = {}
opts['fee_negotiation_step'] = '50%'
opts['close_initiated_by'] = 'opener'
opts['expected_close_fee'] = 20334 if not chainparams['elements'] else 25789
closing_negotiation_step(node_factory, bitcoind, chainparams, opts)
opts['close_initiated_by'] = 'peer'
opts['expected_close_fee'] = 20334 if not chainparams['elements'] else 25789
closing_negotiation_step(node_factory, bitcoind, chainparams, opts)
@unittest.skipIf(EXPERIMENTAL_FEATURES, "anchors uses quick-close, not negotiation") @unittest.skipIf(EXPERIMENTAL_FEATURES, "anchors uses quick-close, not negotiation")
def test_closing_negotiation_step_100pct(node_factory, bitcoind, chainparams): def test_closing_negotiation_step_100pct(node_factory, bitcoind, chainparams):
"""Test that the closing fee negotiation step works, 100%""" """Test that the closing fee negotiation step works, 100%"""
@ -3331,7 +3316,7 @@ def test_anysegwit_close_needs_feature(node_factory, bitcoind):
def test_close_feerate_range(node_factory, bitcoind, chainparams): def test_close_feerate_range(node_factory, bitcoind, chainparams):
"""Test the quick-close fee range negotiation""" """Test the quick-close fee range negotiation"""
l1, l2 = node_factory.line_graph(2, opts={'experimental-quick-close': None}) l1, l2 = node_factory.line_graph(2)
# Lowball the range here. # Lowball the range here.
l1.rpc.close(l2.info['id'], feerange=['253perkw', 'normal']) l1.rpc.close(l2.info['id'], feerange=['253perkw', 'normal'])