lnd icon indicating copy to clipboard operation
lnd copied to clipboard

lnd updatechanpolicy has confusing --help

Open abrkn opened this issue 6 years ago • 13 comments

Background

lncli updatechanpolicy states that the default --time_lock_delta is 0:

--time_lock_delta value  the CLTV delta that will be applied to all forwarded HTLCs (default: 0)

However:

lncli updatechanpolicy --fee_rate 0.001 --base_fee_msat 100000 --time_lock_delta 0```

results in

[lncli] rpc error: code = Unknown desc = time lock delta of 0 is too small, minimum supported is 4


### Your environment

lncli version 0.4.2 commit=a0b2fadea35fa4642daf4e9f56e6ecfe31d22ce1


### Steps to reproduce

lncli updatechanpolicy --fee_rate 0.001 --base_fee_msat 100000 --time_lock_delta 0```

Expected behaviour

Unsure

Actual behaviour

Error. See above.

abrkn avatar Jul 08 '18 15:07 abrkn

You can't have a value of 0 for the CLTV delta. If you did, then you'd be exposed to losing funds on each HTLC you forward, as a race condition is introduced if you ever need to go to the chain for an outgoing HTLC.

Roasbeef avatar Jul 08 '18 23:07 Roasbeef

That's the default value for the cli, not lnd default values. You can see the default values for those fields at lnd -h:

      --bitcoin.minhtlc=                                      The smallest HTLC we are willing to forward on our channels, in millisatoshi (default: 1000)
      --bitcoin.basefee=                                      The base fee in millisatoshi we will charge for forwarding payments on our channels (default: 1000)
      --bitcoin.feerate=                                      The fee rate used when forwarding payments on our channels. The total fee charged is basefee + (amount * feerate / 1000000), where amount is the forwarded amount. (default: 1)
      --bitcoin.timelockdelta=                                The CLTV delta we will subtract from a forwarded HTLC's timelock value (default: 144)

We don't display these values there as it would require lncli to read the config for lnd to see if they user has modified these values.

Roasbeef avatar Jul 08 '18 23:07 Roasbeef

You don't need to set a value, if you aren't actually modifying it.

Roasbeef avatar Jul 08 '18 23:07 Roasbeef

Came here to report the following. Unfortunately, I don't believe you can actually omit the argument:

lnd@LNDMainnet:~$ lncli updatechanpolicy --base_fee_msat=1999 --fee_rate=0.000042
[lncli] time_lock_delta argument missing

... if you refer to the lncli help and try to specify the stated default, it won't let you. Perhaps simply update the lncli help to refer to a sane default value of 144?

ctrlbreak- avatar Jan 03 '19 21:01 ctrlbreak-

agree with ctrlbreak, you can't leave it blank and it tries to prompt you to 0... As an aside, a fee rate of 0.000042 is actually 0.000000000042 satoshis per satoshi sent correct? Am I understanding this correctly? I have mine at 1000, which if I'm correct means I earn 1 satoshi for every 1000 satoshi relayed (ignoring base fee).

dognip avatar Jan 04 '19 18:01 dognip

Reopen to properly set the default value.

halseth avatar Jan 08 '19 20:01 halseth

I'd like to add that better documentation around time_lock_delta is sorely needed. I've been running a node for a few months and done a bunch of reading on LN (although I haven't gotten to the BOLTs yet). I still have almost no clue what time_lock_delta does and I am totally lost at how to decide on a good value for it. The default is 144, lightningwiki.net recommends 10 and otherwise all I know is that it can't be 0.

Chrozayis avatar May 12 '19 14:05 Chrozayis

That's the default value for the cli, not lnd default values. You can see the default values for those fields at lnd -h:

      --bitcoin.minhtlc=                                      The smallest HTLC we are willing to forward on our channels, in millisatoshi (default: 1000)
      --bitcoin.basefee=                                      The base fee in millisatoshi we will charge for forwarding payments on our channels (default: 1000)
      --bitcoin.feerate=                                      The fee rate used when forwarding payments on our channels. The total fee charged is basefee + (amount * feerate / 1000000), where amount is the forwarded amount. (default: 1)
      --bitcoin.timelockdelta=                                The CLTV delta we will subtract from a forwarded HTLC's timelock value (default: 144)

We don't display these values there as it would require lncli to read the config for lnd to see if they user has modified these values.

$ lncli updatechanpolicy --help

Still lists 0 as the default that is the confusion I think

plwalters avatar Nov 21 '19 17:11 plwalters

I am interested in picking this one up. It seems to me that if the flag is not set, the value should not be changed, rather than setting a default value for the flag at the CLI level. If this is not what's desired, please let me know.

SachinMeier avatar Jul 16 '22 08:07 SachinMeier

I think the confusing default values were removed a while ago. What remains is an inconvenience with the CLI library that we use for lncli, where the default value of a flag is printed (now it prints (default: 0) for most flags) and not the actual default value that lnd uses. The default value of 0 on the CLI just means "if there's a 0 we assume the user didn't set the flag).

One option would be to use cli.StringFlag everywhere and manually parsing the numbers, that would remove the text (default: 0) from the help text.

guggero avatar Jul 18 '22 09:07 guggero

I opened a PR to fix exactly this. It is very small. Any review is greatly appreciated. https://github.com/lightningnetwork/lnd/pull/6762

SachinMeier avatar Jul 23 '22 06:07 SachinMeier

Some more confusion on help:

https://docs.lightning.engineering/lightning-network-tools/lnd/channel-fees suggests that I can update things independently, but I can't. For example, if I just want to update the fee rate with --fee_rate, I get

[lncli] base_fee_msat argument missing

then if I also add the base fee with --base_fee_msat, I get

[lncli] time_lock_delta argument missing

.

It seems as though -time_lock_delta, --base_fee_msat, and --fee_rate must all be passed at the same time, they can't be set independently.

AndySchroder avatar Sep 03 '23 16:09 AndySchroder