Browse Source

locktime-blocks: rename to watchtime-blocks.

And clarify the descriptions for end users.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
ppa-0.6.1
Rusty Russell 7 years ago
parent
commit
a2dc3d02a8
  1. 15
      doc/lightningd-config.5.txt
  2. 16
      lightningd/options.c
  3. 10
      tests/test_lightningd.py
  4. 2
      tests/utils.py

15
doc/lightningd-config.5.txt

@ -150,15 +150,16 @@ Lightning node customization options:
Lightning channel and HTLC options:
*locktime-blocks*='BLOCKS'::
How long we need to spot an outdated close attempt, which is also
how long the peer would need to wait if they perform a unilateral
close.
*watchtime-blocks*='BLOCKS'::
How long we need to spot an outdated close attempt: on opening a channel
we tell our peer that this is how long they'll have to wait if they perform
a unilateral close.
*max-locktime-blocks*='BLOCKS'::
The longest we'll ever allow a peer to hold up payments, in the worst
case. If they ask for longer, we'll refuse to create a channel,
and if an HTLC asks for longer, we'll refuse it.
The longest our funds can be delayed (ie. the longest *watchtime-blocks*
our peer can ask for, and also the longest HTLC timeout we will accept).
If our peer asks for longer, we'll refuse to create a channel, and if an
HTLC asks for longer, we'll refuse it.
*funding-confirms*='BLOCKS'::
Confirmations required for the funding transaction when the other side

16
lightningd/options.c

@ -298,6 +298,14 @@ static char *opt_set_anchor(const char *arg, u32 *u)
return opt_set_u32(arg, u);
}
static char *opt_set_locktime(const char *arg, u32 *u)
{
if (!deprecated_apis)
return "--locktime-blocks is now --watchtime-blocks";
return opt_set_u32(arg, u);
}
static void config_register_opts(struct lightningd *ld)
{
opt_register_noarg("--daemon", opt_set_bool, &ld->daemon,
@ -305,9 +313,11 @@ static void config_register_opts(struct lightningd *ld)
opt_register_arg("--ignore-fee-limits", opt_set_bool_arg, opt_show_bool,
&ld->config.ignore_fee_limits,
"(DANGEROUS) allow peer to set any feerate");
opt_register_arg("--locktime-blocks", opt_set_u32, opt_show_u32,
opt_register_arg("--watchtime-blocks", opt_set_u32, opt_show_u32,
&ld->config.locktime_blocks,
"Blocks before peer can unilaterally spend funds");
opt_register_arg("--locktime-blocks", opt_set_locktime, NULL,
&ld->config.locktime_blocks, opt_hidden);
opt_register_arg("--max-locktime-blocks", opt_set_u32, opt_show_u32,
&ld->config.locktime_max,
"Maximum blocks a peer can lock up our funds");
@ -891,7 +901,9 @@ static void add_config(struct lightningd *ld,
abort();
}
} else if (opt->type & OPT_HASARG) {
if (opt->show) {
if (opt->desc == opt_hidden) {
/* Ignore hidden options (deprecated) */
} else if (opt->show) {
char *buf = tal_arr(name0, char, OPT_SHOW_LEN+1);
opt->show(buf, opt->u.carg);

10
tests/test_lightningd.py

@ -1286,7 +1286,7 @@ class LightningDTests(BaseLightningDTests):
def test_bad_opening(self):
# l1 asks for a too-long locktime
l1 = self.node_factory.get_node(options={'locktime-blocks': 100})
l1 = self.node_factory.get_node(options={'watchtime-blocks': 100})
l2 = self.node_factory.get_node(options={'max-locktime-blocks': 99})
ret = l1.rpc.connect(l2.info['id'], 'localhost', l2.port)
@ -1617,7 +1617,7 @@ class LightningDTests(BaseLightningDTests):
disconnects = ['+WIRE_FUNDING_LOCKED', 'permfail']
l1 = self.node_factory.get_node(disconnect=disconnects)
# Make locktime different, as we once had them reversed!
l2 = self.node_factory.get_node(options={'locktime-blocks': 10})
l2 = self.node_factory.get_node(options={'watchtime-blocks': 10})
l1.rpc.connect(l2.info['id'], 'localhost', l2.port)
@ -1701,7 +1701,7 @@ class LightningDTests(BaseLightningDTests):
@unittest.skipIf(not DEVELOPER, "needs DEVELOPER=1")
def test_onchaind_replay(self):
disconnects = ['+WIRE_REVOKE_AND_ACK', 'permfail']
options = {'locktime-blocks': 201, 'cltv-delta': 101}
options = {'watchtime-blocks': 201, 'cltv-delta': 101}
l1 = self.node_factory.get_node(options=options, disconnect=disconnects)
l2 = self.node_factory.get_node(options=options)
@ -3624,7 +3624,7 @@ class LightningDTests(BaseLightningDTests):
# Previous runs with same bitcoind can leave funds!
l1 = self.node_factory.get_node(random_hsm=True)
max_locktime = 5 * 6 * 24
l2 = self.node_factory.get_node(options={'locktime-blocks': max_locktime + 1})
l2 = self.node_factory.get_node(options={'watchtime-blocks': max_locktime + 1})
l1.rpc.connect(l2.info['id'], 'localhost', l2.port)
funds = 1000000
@ -3643,7 +3643,7 @@ class LightningDTests(BaseLightningDTests):
assert l2.rpc.listpeers()['peers'][0]['connected']
# Restart l2 without ridiculous locktime.
del l2.daemon.opts['locktime-blocks']
del l2.daemon.opts['watchtime-blocks']
l2.restart()
l1.rpc.connect(l2.info['id'], 'localhost', l2.port)

2
tests/utils.py

@ -22,7 +22,7 @@ LIGHTNINGD_CONFIG = {
"log-level": "debug",
"cltv-delta": 6,
"cltv-final": 5,
"locktime-blocks": 5,
"watchtime-blocks": 5,
"rescan": 1,
}

Loading…
Cancel
Save