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

Add BumpTransaction event handler #2089

Merged

Commits on Jun 19, 2023

  1. Change package ID computation for HTLC claims on anchor channels

    While the previous way of computing the identifier was safe, it wouldn't
    have been in certain scenarios if we considered splitting aggregated
    packages. While this type of splitting has yet to be implemented, it may
    come in the near future. To ensure we're prepared to handle such, we
    opt to instead commit to all of the HTLCs to claim in the request.
    wpaulino committed Jun 19, 2023
    Configuration menu
    Copy the full SHA
    ce962ad View commit details
    Browse the repository at this point in the history
  2. Expose existing PackageID to API and rename to ClaimId

    In a future commit, we plan to expand `BumpTransactionEvent` variants to
    include the unique identifier assigned to pending output claims by the
    `OnchainTxHandler` when a commitment is broadcast/confirmed. This
    requires making it public in our API. We also choose to rename it to
    `ClaimId` for the benefit of users, as the previous `PackageID` term
    could be interpreted to be the ID of a BIP-331 transaction package.
    wpaulino committed Jun 19, 2023
    Configuration menu
    Copy the full SHA
    537c34b View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    d5cbc6c View commit details
    Browse the repository at this point in the history
  4. Add BumpTransaction event handler

    This allows users to bump their commitments and HTLC transactions
    without having to worry about all the little details to do so. Instead,
    we'll just require that they implement the `CoinSelectionSource` trait
    over their wallet/UTXO source, granting the event handler permission to
    spend confirmed UTXOs for the transactions it'll produce.
    
    While the event handler should in most cases produce valid transactions,
    assuming the provided confirmed UTXOs are valid, it may not produce
    relayable transactions due to not satisfying certain Replace-By-Fee
    (RBF) mempool policy requirements. Some of these require that the
    replacement transactions have a higher feerate and absolute fee than the
    conflicting transactions it aims to replace. To make sure we adhere to
    these requirements, we'd have to persist some state for all transactions
    the event handler has produced, greatly increasing its complexity. While
    we may consider implementing so in the future, we choose to go with a
    simple initial version that relies on the OnchainTxHandler's bumping
    frequency. For each new bumping attempt, the OnchainTxHandler proposes a
    25% feerate increase to ensure transactions can propagate under
    constrained mempool circumstances.
    wpaulino committed Jun 19, 2023
    Configuration menu
    Copy the full SHA
    d4b6f8c View commit details
    Browse the repository at this point in the history
  5. Provide a default CoinSelectionSource implementation via a new trait

    Certain users may not care how their UTXOs are selected, or their wallet
    may not expose enough controls to fully implement the
    `CoinSelectionSource` trait. As an alternative, we introduce another
    trait `WalletSource` they could opt to implement instead, which is much
    simpler as it just returns the set of confirmed UTXOs that may be used.
    This trait implementation is then consumed into a wrapper `Wallet` which
    implements the `CoinSelectionSource` trait using a "smallest
    above-dust-after-spend first" coin selection algorithm.
    wpaulino committed Jun 19, 2023
    Configuration menu
    Copy the full SHA
    bc39da6 View commit details
    Browse the repository at this point in the history