-
Notifications
You must be signed in to change notification settings - Fork 367
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
Re-add support for non-zero-fee-anchors to chan_utils #1828
Re-add support for non-zero-fee-anchors to chan_utils #1828
Conversation
@@ -1193,6 +1195,7 @@ impl_writeable_tlv_based!(CommitmentTransaction, { | |||
(10, built, required), | |||
(12, htlcs, vec_type), | |||
(14, opt_anchors, option), | |||
(16, opt_non_zero_fee_anchors, option), |
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.
alternatively, I can create a const_false
"TLV" directive for the macros, so that nothing is actually serialized for this field.
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 this either needs to be an odd type or an unwrap_or(false)
such that we can read it on new versions that didn't previously serialize this field.
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 don't think so? I think it should be even because old versions should reject it - technically this means a non-forwards-compatible change on VLS' end, but I assume that's okay, it shouldn't matter for LDK users.
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 am doing self.opt_non_zero_fee_anchors.is_some()
instead of self.opt_non_zero_fee_anchors.unwrap_or(false)
, but they are equivalent.
if it was serialized by an old version, the field won't exist, and that will be interpreted as None
.
so this should work as written
1f98f65
to
b67d958
Compare
Codecov ReportBase: 90.72% // Head: 92.37% // Increases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## main #1828 +/- ##
==========================================
+ Coverage 90.72% 92.37% +1.65%
==========================================
Files 91 91
Lines 47896 61923 +14027
Branches 47896 61923 +14027
==========================================
+ Hits 43453 57204 +13751
- Misses 4443 4719 +276
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
Hmm, okay, so if I understand correctly, we're gonna have to keep code around to support this forever - CLN may well go to prod as greenlight with VLS and channels that are non-0-htlc-fee anchors, so future versions will always have to support those channels. Do y'all use the signer directly? Can we avoid passing anything to the signer and just let the |
Ah, right, we do use |
Ah, okay. Separately, it looks like the changes to |
Apologies, missed this comment.
We use |
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.
The logic for dust HTLCs also changed with the zero fee variant (see commit af2ff9b), do we need to bring that back as well?
lightning/src/chain/keysinterface.rs
Outdated
@@ -519,6 +519,8 @@ pub struct InMemorySigner { | |||
channel_value_satoshis: u64, | |||
/// Key derivation parameters | |||
channel_keys_id: [u8; 32], | |||
/// Whether non-zero-fee anchors are enabled (used in conjuction with channel_parameters.opt_anchors) | |||
use_non_zero_fee_anchors: bool, |
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.
Let's include this within ChannelTransactionParameters
instead.
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 would normally do that, but since there's no plan to support this in actual LDK channel operation, it seems it would just touch additional code for not much gain?
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 want to keep signers derivable, except for the parameters that need to be provided through ready_channel
, so I'd prefer all of them be under the channel_parameters
option.
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. done.
@@ -1193,6 +1195,7 @@ impl_writeable_tlv_based!(CommitmentTransaction, { | |||
(10, built, required), | |||
(12, htlcs, vec_type), | |||
(14, opt_anchors, option), | |||
(16, opt_non_zero_fee_anchors, option), |
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 this either needs to be an odd type or an unwrap_or(false)
such that we can read it on new versions that didn't previously serialize this field.
I don't think so - we don't care about supporting on the |
} | ||
} | ||
|
||
/// use non-zero fee anchors | ||
pub fn with_non_zero_fee_anchors(mut self) -> Self { |
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 this needs: (C-not exported) since bindings don't support move semantics
cc @TheBlueMatt
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.
done
lightning/src/chain/keysinterface.rs
Outdated
@@ -519,6 +519,8 @@ pub struct InMemorySigner { | |||
channel_value_satoshis: u64, | |||
/// Key derivation parameters | |||
channel_keys_id: [u8; 32], | |||
/// Whether non-zero-fee anchors are enabled (used in conjuction with channel_parameters.opt_anchors) | |||
use_non_zero_fee_anchors: bool, |
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 want to keep signers derivable, except for the parameters that need to be provided through ready_channel
, so I'd prefer all of them be under the channel_parameters
option.
c4bb578
to
ef2914d
Compare
ef2914d
to
e6b9694
Compare
This would let VLS continue to use LDK past 0.0.111.
I tried to minimize the diff.
Fixes #1822