bitcoinerlab / descriptors

A TypeScript library for parsing Bitcoin Descriptors, including Miniscript-based ones. Streamlines creating Partially Signed Bitcoin Transactions (PSBTs) from Descriptors. Features BIP32, single-signature, and Hardware Wallet signing capabilities, and facilitates finalizing transactions.
https://bitcoinerlab.com/modules/descriptors
46 stars 14 forks source link

Add RBF Parameter Support to PSBT Inputs, Update Dependencies, and Set RBF Default to True #37

Closed landabaso closed 3 months ago

landabaso commented 3 months ago

Overview

This PR introduces support for the rbf parameter in the updatePsbtAsInput method, allowing users to specify whether a transaction should use Replace-By-Fee (RBF). The update ensures that transactions utilizing relative timelocks automatically opt into RBF unless explicitly disabled. Key changes include:

Details

  1. README Update: Detailed the usage of the rbf parameter in updatePsbtAsInput, including its default behavior and implications for transactions using relative timelocks.

  2. Descriptor Changes:

    • Added rbf parameter handling in updatePsbtAsInput.
    • Ensured nSequence values comply with both relative timelocks and RBF requirements.
  3. PSBT Changes:

    • Integrated logic to set nSequence values correctly based on rbf parameter.
    • Added error handling for incompatible sequence and RBF settings.
  4. Dependency Updates:

    • Bumped @bitcoinerlab/miniscript to version 1.4.0.
    • Bumped @bitcoinerlab/secp256k1 to version 1.1.1.
  5. Default Behavior Change:

    • The rbf parameter now defaults to true, which changes the default behavior from previous versions where it was not explicitly set. This ensures that transactions are replaceable by default unless specified otherwise.

Notes

This update provides more control over transaction fee adjustments and ensures correct behavior with relative timelocks.