-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
[anchors] zero-fee HTLC secondlevel transactions #4840
[anchors] zero-fee HTLC secondlevel transactions #4840
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.
Very straight forward change! No major comments, I think if we're in agreement re 0 fees vs 1 sat/byte, then this can go in as soon as the dependent PRs are merged.
// For zero-fee HTLC channels, this will always be zero, regardless of | ||
// feerate. | ||
if chanType.ZeroFeeSecondLevel() { | ||
return 0 |
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.
EZ 😎
Could also instead have the param be passed in (0
in this case) if we want to make it a constant so it can be modified easily later. Based on recent discussions though, it seems like the zero fee route may be the best way forward.
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.
I prefer zero, since that mitigates the fee leak completely.
8f6be06
to
f6404f6
Compare
chanbackup/single.go
Outdated
|
||
// ZeroFeeSecondLevelCommitVersion is a version that denotes this | ||
// channel isusing the zero-fee second-level anchor commitment format. | ||
ZeroFeeSecondLevelCommitVersion = 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.
We don't strictly need a new version, since on recovery we don't handle HTLCs anyway.
2627fc7
to
d7f942b
Compare
Updated with latest terminology used in the spec PR: lightning/bolts#824 |
d7f942b
to
d63df17
Compare
Needs a rebase! |
b81b862
to
387adc6
Compare
feature/deps.go
Outdated
@@ -58,6 +58,7 @@ var deps = depDesc{ | |||
lnwire.AnchorsOptional: { | |||
lnwire.StaticRemoteKeyOptional: {}, | |||
}, | |||
lnwire.AnchorsZeroFeeHtlcTxOptional: {}, |
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.
Remove optional signal as well? Can defer perhaps until the rc phase as well
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.
This is just the dependency check, I don't think it affects the signalling, @cfromknecht ?
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 this can be removed, this is equivalent to not having an entry in the dep map
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.
Ok, removed! Should we remove the lnwire.AnchorsOptional
entry also?
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.
LGTM 🐉
feature/deps.go
Outdated
@@ -58,6 +58,7 @@ var deps = depDesc{ | |||
lnwire.AnchorsOptional: { | |||
lnwire.StaticRemoteKeyOptional: {}, | |||
}, | |||
lnwire.AnchorsZeroFeeHtlcTxOptional: {}, |
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 this can be removed, this is equivalent to not having an entry in the dep map
// implicitly mean we'll create the channel of this type. Note that | ||
// this also enables tweakless commitments, as anchor commitments are | ||
// always tweakless. | ||
localAnchors := localFeatures.HasFeature( |
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.
👍
|
||
// NoAnchors should be set if we don't want to support opening or accepting | ||
// channels having the anchor commitment type. | ||
NoAnchors bool `long:"no-anchors" description:"disable support 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.
not sure how specific we want to be here, but does it make sense to clarify that this is anchor_zero_fee_htlc
vs just anchor_outputs
?
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.
I think users interacting with this flag don't have to know about the difference.
|
||
// Anchors enables anchor commitments. | ||
// TODO(halseth): transition itests to anchors instead! | ||
Anchors bool `long:"anchors" description:"enable support 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.
before this was NoAnchors
, now it's back to Anchors
?
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.
So there's two different versions of the config now: one for the itests, and the one for the rest. This commit makes the default one have anchor on, while the itest one it's off by default.
…es support We assume the legacy anchor type is no longer advertised by us.
e90dedb
to
64659e6
Compare
This PR enables an extension to the
anchor
commitment type that makes second-level HTLC transactions pay a zero fee, meaning they will have to have fees added as in #4779.This PR adds this type to the already existing
anchors
type, meaning all new anchor channels being opened will have this enabled (as long as both nodes support it). Existing anchor channels will stay the same.TODO
Builds on
#4779