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

[5/5]sweep: introduce budget-based deadline aware fee bumper #8424

Merged

Commits on Apr 2, 2024

  1. sweep: expand InputSet with more interface methods

    This commit adds more interface methods to `InputSet` to prepare the
    addition of budget-based aggregator.
    yyforyongyu committed Apr 2, 2024
    Configuration menu
    Copy the full SHA
    3f8da35 View commit details
    Browse the repository at this point in the history
  2. sweep: change markInputsPublishFailed to take outpoints

    This way it's easier to pass values to this method in various callsites.
    yyforyongyu committed Apr 2, 2024
    Configuration menu
    Copy the full SHA
    d00c104 View commit details
    Browse the repository at this point in the history
  3. sweep: refactor markInputsPendingPublish to take InputSet

    This commit changes `markInputsPendingPublish` to take `InputSet` only.
    This is needed for the following commits as we won't be able to know the
    tx being created beforehand, yet we still want to make sure these inputs
    won't be grouped to another input set as it complicates our RBF process.
    yyforyongyu committed Apr 2, 2024
    Configuration menu
    Copy the full SHA
    bd9256e View commit details
    Browse the repository at this point in the history
  4. sweep: introduce BudgetInputSet to manage budget-based inputs

    This commit adds `BudgetInputSet` which implements `InputSet`. It
    handles the pending inputs based on the supplied budgets and will be
    used in the following commit.
    yyforyongyu committed Apr 2, 2024
    Configuration menu
    Copy the full SHA
    0496d70 View commit details
    Browse the repository at this point in the history
  5. sweep: introduce BudgetAggregator to cluster inputs by deadlines

    This commit adds `BudgetAggregator` as a new implementation of
    `UtxoAggregator`. This aggregator will group inputs by their deadline
    heights and create input sets that can be used directly by the fee
    bumper for fee calculations.
    yyforyongyu committed Apr 2, 2024
    Configuration menu
    Copy the full SHA
    9565c3b View commit details
    Browse the repository at this point in the history
  6. sweep: introduce Bumper interface to handle RBF

    This commit adds a new interface, `Bumper`, to handle RBF for a given
    input set. It's responsible for creating the sweeping tx using the input
    set, and monitors its confirmation status to decide whether a RBF should
    be attempted or not.
    
    We leave implementation details to future commits, and focus on mounting
    this `Bumper` interface to our sweeper in this commit.
    yyforyongyu committed Apr 2, 2024
    Configuration menu
    Copy the full SHA
    481216f View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    818d1c2 View commit details
    Browse the repository at this point in the history
  8. sweep: remove RBF related tests

    As there will be dedicated new tests for them.
    yyforyongyu committed Apr 2, 2024
    Configuration menu
    Copy the full SHA
    15872dc View commit details
    Browse the repository at this point in the history
  9. sweep: remove FeeRate() from InputSet interface

    As shown in the following commit, fee rate calculation will now be
    handled by the fee bumper, hence there's no need to expose this on
    `InputSet` interface.
    yyforyongyu committed Apr 2, 2024
    Configuration menu
    Copy the full SHA
    7af5bba View commit details
    Browse the repository at this point in the history
  10. sweep: add FeeFunction interface and a linear implementation

    This commit adds a new interface, `FeeFunction`, to deal with
    calculating fee rates. In addition, a simple linear function is
    implemented, hence `LinearFeeFunction`, which will be used to calculate
    fee rates when bumping fees. Check lightningnetwork#4215 for other type of fee functions
    that can be implemented.
    yyforyongyu committed Apr 2, 2024
    Configuration menu
    Copy the full SHA
    f354b65 View commit details
    Browse the repository at this point in the history
  11. Configuration menu
    Copy the full SHA
    447cf5c View commit details
    Browse the repository at this point in the history
  12. lnwallet+sweep: calculate max allowed feerate on BumpResult

    This commit adds the method `MaxFeeRateAllowed` to calculate the max fee
    rate. The caller may specify a large MaxFeeRate value, which cannot be
    cover by the budget. In that case, we default to use the max feerate
    calculated using `budget/weight`.
    yyforyongyu committed Apr 2, 2024
    Configuration menu
    Copy the full SHA
    6e84fe6 View commit details
    Browse the repository at this point in the history
  13. lnwallet+sweep: introduce TxPublisher to handle fee bump

    This commit adds `TxPublisher` which implements `Bumper` interface. This
    is part one of the implementation that focuses on implementing the
    `Broadcast` method which guarantees a tx can be published with
    RBF-compliant. It does so by leveraging the `testmempoolaccept` API,
    keep increasing the fee rate until an RBF-compliant tx is made and
    broadcasts it.
    
    This tx will then be monitored by the `TxPublisher` and in the following
    commit, the monitoring process will be added.
    yyforyongyu committed Apr 2, 2024
    Configuration menu
    Copy the full SHA
    4ca1de3 View commit details
    Browse the repository at this point in the history
  14. sweep: add monitor loop to TxPublisher

    This commit finishes the implementation of `TxPublisher` by adding the
    monitor process. Whenever a new block arrives, the publisher will check
    all its monitored records and attempt fee bumping them if necessary.
    yyforyongyu committed Apr 2, 2024
    Configuration menu
    Copy the full SHA
    d5b5b76 View commit details
    Browse the repository at this point in the history
  15. Configuration menu
    Copy the full SHA
    3365333 View commit details
    Browse the repository at this point in the history
  16. sweep: increase delta fee rate precision in fee function

    This commit adds a private type `mSatPerKWeight` that expresses a given
    fee rate in millisatoshi per kw. This is needed to increase the
    precision of the fee function. When sweeping anchor inputs, if using a
    deadline delta of over 1000, it's likely the delta will be 0 sat/kw due
    to precision.
    yyforyongyu committed Apr 2, 2024
    Configuration menu
    Copy the full SHA
    0103345 View commit details
    Browse the repository at this point in the history
  17. Configuration menu
    Copy the full SHA
    83729e2 View commit details
    Browse the repository at this point in the history
  18. Configuration menu
    Copy the full SHA
    1bd2589 View commit details
    Browse the repository at this point in the history
  19. sweep: make sure non-fee related errors are notified

    So these inputs can be retried by the sweeper.
    yyforyongyu committed Apr 2, 2024
    Configuration menu
    Copy the full SHA
    4bf98e7 View commit details
    Browse the repository at this point in the history