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 RBF Parameter Support to PSBT Inputs, Update Dependencies, and Set RBF Default to True #37

Merged
merged 2 commits into from
Jul 4, 2024

Conversation

landabaso
Copy link
Member

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:

  • README.md: Updated to document the rbf parameter in updatePsbtAsInput.
  • src/descriptors.ts: Enhanced to process the rbf parameter.
  • src/psbt.ts: Integrated RBF logic with nSequence management.
  • package.json & package-lock.json: Updated dependencies for @bitcoinerlab/miniscript and @bitcoinerlab/secp256k1.
  • Default Behavior Change: The rbf parameter now defaults to true, differing from previous versions where it was not explicitly set.

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

  • Transactions using relative timelocks (nSequence < 0x80000000) inherently opt into RBF due to the overlapping nSequence value ranges.
  • The rbf parameter is optional and defaults to true, ensuring backward compatibility.

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

- Updated README.md to include `rbf` parameter in the `updatePsbtAsInput` method.
- Modified `src/descriptors.ts` to handle `rbf` parameter for PSBT inputs.
- Updated `src/psbt.ts` to integrate RBF logic with nSequence.
- Set RBF parameter default to true, altering default behavior from previous versions.

This update ensures transactions using relative timelocks correctly opt into RBF, providing flexibility for transaction fee adjustments while ensuring compatibility with relative timelocks.
- Bumped versions of `@bitcoinerlab/miniscript` and `@bitcoinerlab/secp256k1` in package.json and package-lock.json.
- Bump to version 2.2.0 since prev commit alters default behavior from previous versions.

This update ensures transactions using relative timelocks correctly opt into RBF, providing flexibility for transaction fee adjustments while ensuring compatibility with relative timelocks.
@landabaso landabaso merged commit 8fe1bc0 into main Jul 4, 2024
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.

1 participant