[bug]: high values for time_lock_delta can result in unexpected setting of 0 #7320
Labels
bug
Unintended code behaviour
good first issue
Issues suitable for first time contributors to LND
lncli
P2
should be fixed if one has time
policy
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
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
The text was updated successfully, but these errors were encountered: