New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
multi: configurable anchor commitment conf target #6025
base: master
Are you sure you want to change the base?
multi: configurable anchor commitment conf target #6025
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good Job, thanks for putting me in cc :)
htlcswitch/link.go
Outdated
@@ -1104,10 +1108,17 @@ func (l *channelLink) htlcManager() { | |||
continue | |||
} | |||
|
|||
// For normal channels, we use a conf target of 3 to | |||
// determine the current network fee. | |||
confTarget := uint32(3) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: would be cool to have also a constant for this variable like for example: defaultCommitmentConfTarget = 3? Why are we using 3, is it just a common agreement ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good idea, I will move it out to a constant.
Yes i think using 3 was just the norm.
64a005d
to
3f2a64a
Compare
!lightninglabs-deploy mute 2022-Jan-01 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great PR, only minor comments!
htlcswitch/link.go
Outdated
@@ -1104,10 +1113,17 @@ func (l *channelLink) htlcManager() { | |||
continue | |||
} | |||
|
|||
// For normal channels, we use a conf target of 3 to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: I wouldn't hardcode 3 here in case we bump defaultCommitmentConfTarget
.
htlcswitch/link.go
Outdated
// chain in within the given confirmation target. The returned value is | ||
// expressed in fee-per-kw, as this is the native rate used when computing the | ||
// fee for commitment transactions, and the second-level HTLC transactions. | ||
func (l *channelLink) sampleNetworkFee(confTarget uint32) (chainfee.SatPerKWeight, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wrap at 80 while we're here?
config.go
Outdated
@@ -348,6 +352,8 @@ type Config struct { | |||
|
|||
MaxCommitFeeRateAnchors uint64 `long:"max-commit-fee-rate-anchors" description:"The maximum fee rate in sat/vbyte that will be used for commitments of channels of the anchors type. Must be large enough to ensure transaction propagation"` | |||
|
|||
AnchorsCommitConfTarget uint32 `long:"anchors-commit-conf-target" description:"The target number of blocks to be used to estimate the fee to use for anchor commitments"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Difficult to express succinctly, but can we add a note clarifying that this is only for commitments/force closes? I can see end user confusion thinking that we'll use this for cooperative close, which is not the case?
func (l *channelLink) sampleNetworkFee() (chainfee.SatPerKWeight, error) { | ||
// We'll first query for the sat/kw recommended to be confirmed within 3 | ||
// blocks. | ||
feePerKw, err := l.cfg.FeeEstimator.EstimateFeePerKW(3) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since anchors are the default channel type in lnd, we're effectively dropping our fee rates for all our commitments to conf target = 3 to 6 with this change. Are we good with that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah good question. Perhaps we should leave it at 3 for now and let those who want to change it change it?
Just seems weird to use anchor channels and then still set a high conf target. But maybe it is best to leave it as is while we wait for package relay? thoughts @Roasbeef ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we're effectively dropping our fee rates
Wouldn't we be increasing our fee rates bc faster conf time?
NVM, thought we were going from 6 -> 3
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thinking we should stick to 3 as default unless we have a reason to change. It's 3 for autopilot
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this commit, a new config option is added so that users can set the confirmation target to be used for anchor commitments. The default value is set to 6. Before this commit, a conf target of 3 was used.
3f2a64a
to
ff17f45
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the review @carlaKC 🚀 updated as per suggestion. Good question re dropping from a 3 to 6 conf target for our default chan type, will defs get a second opinion re than
func (l *channelLink) sampleNetworkFee() (chainfee.SatPerKWeight, error) { | ||
// We'll first query for the sat/kw recommended to be confirmed within 3 | ||
// blocks. | ||
feePerKw, err := l.cfg.FeeEstimator.EstimateFeePerKW(3) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah good question. Perhaps we should leave it at 3 for now and let those who want to change it change it?
Just seems weird to use anchor channels and then still set a high conf target. But maybe it is best to leave it as is while we wait for package relay? thoughts @Roasbeef ?
func (l *channelLink) sampleNetworkFee() (chainfee.SatPerKWeight, error) { | ||
// We'll first query for the sat/kw recommended to be confirmed within 3 | ||
// blocks. | ||
feePerKw, err := l.cfg.FeeEstimator.EstimateFeePerKW(3) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thinking we should stick to 3 as default unless we have a reason to change. It's 3 for autopilot
@@ -365,6 +365,10 @@ | |||
; propagation (default: 10) | |||
; max-commit-fee-rate-anchors=5 | |||
|
|||
; The confirmation target to be used to estimate the fee to be used for anchor | |||
; commitment transactions. (default: 6) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe mention anchor commitment txs are default and modifying this setting will apply to all channels? users may avoid this setting because it looks scary and technical unless told otherwise
@ellemouton, remember to re-request review from reviewers when ready |
!lightninglabs-deploy mute 2022-April-04 |
I think this is no longer needed (?) now that we'll not sweep anchors until we actually need to? Then once their swept, |
but doesnt that require a user to actively go and bump it then? This just allows them to set the default target if they want. happy to close though - lemme know what you think |
So I think it makes sense to distinguish between anchor and non-anchor channels but I probably think we should just make sure we always use the min_relay_fee for anchors, but not only ours but taking the ones of our peers into account as well (relates to #8302) |
In this commit, a new config option is added so that users can set the
confirmation target to be used for anchor commitments. The default value
is set to 6. Before this commit, a conf target of 3 was used.
cc @ziggie1984