Skip to content

multi: add control over maximum acceptable local CSV delay#4735

Merged
carlaKC merged 3 commits intolightningnetwork:masterfrom
carlaKC:2426-defaultmaxcsv
Nov 5, 2020
Merged

multi: add control over maximum acceptable local CSV delay#4735
carlaKC merged 3 commits intolightningnetwork:masterfrom
carlaKC:2426-defaultmaxcsv

Conversation

@carlaKC
Copy link
Collaborator

@carlaKC carlaKC commented Oct 29, 2020

This PR provides nodes with a MaxLocalCSV config option which specifies the maximum delay that we will accept from the remote peer. This value allows users to set a maximum default value that suits their time preference. We do cap this value at 144 blocks at present, to ensure that users don't set an unreasonably low CSV which results in no channels ever succeeding.

For channels we open: this maximum can be set on a per-channel basis using max_local_csv, defaulting to our config option if this value is not set
For channels peers open: we will enforce the default value for all channels, and the channelacceptor can be used to take more custom actions.

Fixes #2426

@carlaKC carlaKC requested review from Crypt-iQ and removed request for Roasbeef and cfromknecht October 29, 2020 10:19
@carlaKC carlaKC force-pushed the 2426-defaultmaxcsv branch from 272e2f0 to d532d44 Compare October 29, 2020 10:23
Copy link
Contributor

@halseth halseth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice addition, LGTM 👍

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rename to defaultMaxLocalCSVDelay and move to config

@Roasbeef Roasbeef requested review from bhandras and removed request for Crypt-iQ November 4, 2020 01:37
@Roasbeef Roasbeef added this to the 0.12.0 milestone Nov 4, 2020
Copy link
Collaborator

@bhandras bhandras left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, just a few nits 🦘

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you wanted to write "our maximum is is less than"

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: could add a new line

lncfg/chain.go Outdated
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

q: why not call this config value MaxLocalCSVDelay?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was following the naming for the existing DefaultRemoteDelay, since they're related.

@bhandras
Copy link
Collaborator

bhandras commented Nov 4, 2020

needs rebase

To allow nodes more control over the amount of time that their funds
will be locked up, we add a MaxLocalCSVDelay option which sets the
maximum csv delay we will accept for all channels. We default to the
existing constant of 10000, and set a sane minimum on this value so that
clients cannot set unreasonably low maximum csv delays which will result
in their node rejecting all channels.
@carlaKC carlaKC force-pushed the 2426-defaultmaxcsv branch from d532d44 to f1aa3d2 Compare November 4, 2020 11:58
@carlaKC carlaKC merged commit a0ab96d into lightningnetwork:master Nov 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature Request: Specify the lowest CSV delay we're willing to accept

4 participants