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 FeeEstimator to introduce local target variants #352

Merged
merged 2 commits into from
Aug 30, 2024

Conversation

tnull
Copy link
Collaborator

@tnull tnull commented Aug 29, 2024

.. previously we used LDK's FeeEstimator and ConfirmationTarget and ~misused some of the latter's variants for our non-Lightning operations.

Here, we introduce our own FeeEstimator and ConfirmationTarget allowing to add specific variants for ChannelFunding and OnchainPayments, for example.

(This is can also be viewed as a prefactor to #176, which we'll do as part of / after the upcoming rust-bitcoin/BDK upgrade)

@tnull tnull force-pushed the 2024-08-fee-estimator-refactor branch from 1930aad to a007882 Compare August 29, 2024 11:00
@tnull tnull requested a review from jkczyz August 29, 2024 11:01
@tnull tnull force-pushed the 2024-08-fee-estimator-refactor branch 2 times, most recently from ecfa9f6 to cebf11b Compare August 29, 2024 11:10
src/fee_estimator.rs Outdated Show resolved Hide resolved
Comment on lines +97 to +98
ConfirmationTarget::OnchainPayment => 6,
ConfirmationTarget::ChannelFunding => 12,
Copy link

Choose a reason for hiding this comment

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

Seems like in practice the values are the same as before. Is this change to allow us to vary them in the future?

Copy link
Collaborator Author

@tnull tnull Aug 30, 2024

Choose a reason for hiding this comment

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

Yes, I intentionally left the behavior unchanged for now. This is really only an overdue refactor and also prepares for the LDK upgrade where we'll get more ConfirmationTargets and in particular will split OnChainSweep.

At some point in the future (probably when tackling #176), we'll revisit if the chosen defaults could be improved in any way, or if they are fine as is.

pub struct Wallet<D, B: Deref, E: Deref, L: Deref>
pub(crate) struct Wallet<D, B: Deref, E: Deref, L: Deref>
Copy link

@jkczyz jkczyz Aug 29, 2024

Choose a reason for hiding this comment

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

Visibility control for Wallet and WalletKeysManager (below) seem unrelated to to the commits purpose.

Copy link
Collaborator Author

@tnull tnull Aug 30, 2024

Choose a reason for hiding this comment

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

I thought so, too, but rustc 1.63 seemed to think otherwise (as the new FeeEstimator is pub(crate), it complained that I couldn't leak a pub(crate) trait in a pub struct, nevermind that in fact the module itself is pub(crate)). I now split the visibility changes out to their own commit though.

@tnull tnull force-pushed the 2024-08-fee-estimator-refactor branch 2 times, most recently from 138bf61 to 9b1ea5a Compare August 30, 2024 06:38
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 used LDK's `FeeEstimator` and `ConfirmationTarget` and
~misused some of the latter's variants for our non-Lightning operations.

Here, we introduce our own `FeeEstimator` and `ConfirmationTarget`
allowing to add specific variants for `ChannelFunding` and
`OnchainPayment`s, for example.
@tnull tnull force-pushed the 2024-08-fee-estimator-refactor branch from 9b1ea5a to 42a695e Compare August 30, 2024 14:58
@tnull
Copy link
Collaborator Author

tnull commented Aug 30, 2024

LGTM. Please squash.

Squashed without further changes.

@tnull tnull merged commit 4535c5f into lightningdevkit:main Aug 30, 2024
12 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.

2 participants