Skip to content

Features/txbuilder expose params#839

Closed
xsats wants to merge 19 commits intobitcoindevkit:masterfrom
xsats:features/txbuilder-expose-params
Closed

Features/txbuilder expose params#839
xsats wants to merge 19 commits intobitcoindevkit:masterfrom
xsats:features/txbuilder-expose-params

Conversation

@xsats
Copy link
Copy Markdown

@xsats xsats commented Jan 20, 2023

Description

Currently, tx_builder TxParams are not exposed publicly, although it has been noted in the code the intention for the struct to be exposed publicly. Exposing TxParams enables the current state of TxBuilder (i.e. loaded transaction parameters) to be accessed prior to calling tx_builder::finish() to construct a PSBT.

This would be useful for a number of reasons, including enabling BDK users to view and validate the configuration of a TxBuilder instance at a specific point in the code without needing to finalise TxBuilder to obtain a PSBT (and subsequently initialise a brand new TxBuilder from scratch if e.g. something intended is missing) which is necessary at present since TxBuilder's contents are private.

This PR introduces a tx_builder::get_params() method which can be called on a TxBuilder instance at any time to retrieve the current state of the TxBuilder/TxParams, and adds a basic corresponding get_params() test.

Notes to the reviewers

The tx_builder_test TxBuilder instance used in the get_params() test was kept barebones, with only two tx config options added via their respective methods, in an attempt to keep the test data size to a minimum and avoid clutter.

If it's deemed beneficial for a more complex/realistic TxBuilder instance to be used in the get_params() test, I can add additional TxBuilder methods (e.g. recipients, fee rate) and amend the expected test data respectively.

Changelog notice

  • Add wallet::tx_builder::get_params method

Checklists

All Submissions:

  • I've signed all my commits
  • I followed the contribution guidelines
  • I ran cargo fmt and cargo clippy before committing

New Features:

  • I've added tests for the new feature
  • I've added docs for the new feature

Copy link
Copy Markdown
Contributor

@w0xlt w0xlt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Concept ACK

@notmandatory
Copy link
Copy Markdown
Member

Concept ACK, this needs a rebase.

@thunderbiscuit
Copy link
Copy Markdown
Member

Concept ACK I think this would be a useful method.

The PR has picked up a bunch of other work however, and so it's very hard to review. I'm wondering if it could be cleaned up to help reviewers.

@LLFourn
Copy link
Copy Markdown
Collaborator

LLFourn commented Feb 19, 2023

Concept ACK but don't merge this before #793. We have an issue to re-do tx building eventually: LLFourn/bdk_core_staging#40

@notmandatory notmandatory removed this from the Release 0.27.2 Feature Freeze milestone Mar 3, 2023
@notmandatory
Copy link
Copy Markdown
Member

@xsats after the alpha.1 release is tagged would be a good time to rebase this one so we can try to get it into the alpha.2 release.

@notmandatory notmandatory added module-wallet api A breaking API change labels Mar 18, 2024
@notmandatory notmandatory added this to the 1.0.0-alpha milestone Mar 18, 2024
@notmandatory notmandatory added the new feature New feature or request label Mar 18, 2024
@notmandatory notmandatory removed this from the 1.0.0-alpha milestone Mar 18, 2024
@evanlinjin
Copy link
Copy Markdown
Member

Outdated. Also we have put a feature freeze on TxBuilder in favor of work that is currently in bdk-tx.

@evanlinjin evanlinjin closed this Apr 15, 2025
@github-project-automation github-project-automation Bot moved this from Needs Review to Done in BDK Wallet Apr 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api A breaking API change module-wallet new feature New feature or request

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

10 participants