Skip to content
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

Refactor ChannelConfig / MaxDustHTLCExposure #350

Merged
merged 1 commit into from
Aug 28, 2024

Conversation

tnull
Copy link
Collaborator

@tnull tnull commented Aug 25, 2024

Closes #349.

Previously, we chose to expose ChannelConfig as a Uniffi interface, providing accessor methods. Unfortunately this forced us to Arc it everywhere in the API, and also didn't allow to retrieve the currently set dust exposure limits. Here, we refactor our version of ChannelConfig to be a normal struct (Uniffi dictionary), and only expose the MaxDustHTLCExposure as an enum-interface.

@tnull tnull marked this pull request as draft August 25, 2024 10:17
@tnull tnull force-pushed the 2024-08-channel-config-refactor branch 4 times, most recently from 1ff6d08 to 7ba4abc Compare August 25, 2024 12:05
@tnull tnull requested a review from jkczyz August 27, 2024 10:16
@tnull tnull marked this pull request as ready for review August 27, 2024 10:16
src/types.rs Outdated
/// This sets a fixed limit on the total dust exposure in millisatoshis.
///
/// Please refer to [`LdkMaxDustHTLCExposure`] for further details.
FixedLimitMsat {
Copy link

Choose a reason for hiding this comment

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

Do we need to duplicate the units here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

You mean I could drop the Msat part? I guess so, now added a fixup.

/// Please refer to [`LdkMaxDustHTLCExposure`] for further details.
FeeRateMultiplier {
/// The applied fee rate multiplier.
multiplier: u64,
Copy link

Choose a reason for hiding this comment

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

Should we include the units _sats_per_kw?

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 don't think so, a multiplier is unitless?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Now added a fixup dropping the (in sats/KW) from the comment as IMO it's misleading (the feerate has a unit, but it doesn't matter which one, the multiplier is just a multiplier.

Copy link

Choose a reason for hiding this comment

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

Yeah, thanks I misread that

Copy link

@jkczyz jkczyz left a comment

Choose a reason for hiding this comment

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

LGTM. Please squash.

Previously, we chose to expose `ChannelConfig` as a Uniffi `interface`,
providing accessor methods. Unfortunately this forced us to `Arc` it
everywhere in the API, and also didn't allow to retrieve the currently
set dust exposure limits. Here, we refactor our version of
`ChannelConfig` to be a normal `struct` (Uniffi `dictionary`), and only
expose the `MaxDustHTLCExposure` as an enum-`interface`.
@tnull tnull force-pushed the 2024-08-channel-config-refactor branch from 5695195 to 09d68ee Compare August 28, 2024 14:11
@tnull
Copy link
Collaborator Author

tnull commented Aug 28, 2024

LGTM. Please squash.

Squashed without further changes.

@tnull tnull merged commit ea448a1 into lightningdevkit:main Aug 28, 2024
11 of 13 checks passed
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.

Refactor ChannelConfig
2 participants