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

sweepbatcher: add greedy batch selection algorithm #787

Merged

Commits on Jul 18, 2024

  1. Configuration menu
    Copy the full SHA
    1290ebe View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    1f1a274 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    ccd1b31 View commit details
    Browse the repository at this point in the history
  4. sweepbatcher: MinFeeRate -> WithCustomFeeRate

    The reason is because we want to know in advance if fee rates come from
    an external source or are determined by sweepbatcher internally.
    
    Also remove WithNoBumping option. It is now a part of WithCustomFeeRate:
    if WithCustomFeeRate is passed, automatic fee bumping by sweepbatcher
    is disabled.
    starius committed Jul 18, 2024
    Configuration menu
    Copy the full SHA
    e814157 View commit details
    Browse the repository at this point in the history
  5. sweep: factor out function AddOutputEstimate

    It adds output to transaction weight estimator depending on address type.
    starius committed Jul 18, 2024
    Configuration menu
    Copy the full SHA
    019d3c6 View commit details
    Browse the repository at this point in the history
  6. sweepbatcher: add greedy batch selection algorithm

    If custom fee rates are used, the algorithm is tried. It selects a batch for the
    sweep using the greedy algorithm, which minimizes costs, and adds the sweep to
    the batch. If it fails, old algorithm is used, trying to add to any batch, or
    starting a new batch.
    starius committed Jul 18, 2024
    Configuration menu
    Copy the full SHA
    44d9147 View commit details
    Browse the repository at this point in the history
  7. sweepbatcher: fix inaccuracies in fee estimations

    Use SigHashDefault instead of SigHashAll in weight estimations.
    Actual code uses SigHashDefault, not SigHashAll. SigHashAll is 1wu larger.
    
    Use the actual destination address in weight estimator, not taproot always.
    In the test the type of address is P2WPKH, not taproot.
    
    Updated testSweepFetcher to calculate fee, fee rate and weight accurately and
    to compare the data observed in the published transaction with the estimates.
    starius committed Jul 18, 2024
    Configuration menu
    Copy the full SHA
    db5e0d1 View commit details
    Browse the repository at this point in the history
  8. sweepbatcher: log batcher failures

    This is useful to debug. It used to fail silently.
    starius committed Jul 18, 2024
    Configuration menu
    Copy the full SHA
    f5e97c0 View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    5dac7ca View commit details
    Browse the repository at this point in the history
  10. sweepbatcher: always fill sweep.minFeeRate

    Use customFeeRate if it is provided, otherwise use wallet's EstimateFeeRate.
    
    Added flag SkipNextBump to rbfCache to avoid extra bumping upon updating
    fee rate externally.
    
    Fix test TestSweepBatcherCloseDuringAdding, it didn't have confTarget and
    failed in wallet.EstimateFeeRate call.
    starius committed Jul 18, 2024
    Configuration menu
    Copy the full SHA
    75641c3 View commit details
    Browse the repository at this point in the history
  11. sweepbatcher: always try greedy batch selection

    Now that sweep.minFeeRate is always set, greedy batch selection has all needed
    inputs to work even without customFeeRate provider.
    starius committed Jul 18, 2024
    Configuration menu
    Copy the full SHA
    026cf0d View commit details
    Browse the repository at this point in the history
  12. Configuration menu
    Copy the full SHA
    7a61d5e View commit details
    Browse the repository at this point in the history