-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Description
Hello,
updatechanpolicy's time_lock_delta can roll over when very high values are used, which might result in a setting of 0.
I noticed this in a happy accident, where I used the channel_id instead of the channel_point and also forgot to actually
set time_lock_delta. So my channel_id got parsed as --time_lock_delta.
lncli --network testnet updatechanpolicy --fee_rate 0 --base_fee_msat 0 844393044316848128
resulted in time_lock_delta getting set to 0 for all my channels...
This shouldn't even be possible, because normally it complains that the minimum value is 18.
Your environment
tlv/v1.1.0-130-g143eba82e (0.15.99-beta current git master)
Linux lnd-test2 5.10.0-18-amd64 #1 SMP Debian 5.10.140-1 (2022-09-02) x86_64 GNU/Linux
bitcoin-core 23.0
Steps to reproduce
lncli --network testnet updatechanpolicy --fee_rate 0 --base_fee_msat 0 844393044316848128
Expected behaviour
Failure or time_lock_delta set to a high value
Actual behaviour
time_lock_delta got set to 0 for all my channels
$ lncli --network testnet getchaninfo 2610605642201169921
{
[...]
"node1_policy": {
"time_lock_delta": 0,
"min_htlc": "1000",
"fee_base_msat": "0",
"fee_rate_milli_msat": "0",
"disabled": false,
"max_htlc_msat": "1458270000",
"last_update": 1673657439,
"custom_records": {
}
},
[...]
$ lncli --network testnet getchaninfo 2610596846108147712
{
[...]
"node1_policy": {
"time_lock_delta": 0,
"min_htlc": "1000",
"fee_base_msat": "0",
"fee_rate_milli_msat": "0",
"disabled": false,
"max_htlc_msat": "990000000",
"last_update": 1673657439,
"custom_records": {
}
},
[...]
Additional Info
This might be caused by a 32bit roll over, as this still works as expected:
lncli --network testnet updatechanpolicy --fee_rate 0 --base_fee_msat 0 --time_lock_delta 2147483647
results in time_lock_delta 65535
while this results in setting it to zero again:
lncli --network testnet updatechanpolicy --fee_rate 0 --base_fee_msat 0 --time_lock_delta 2147483648