Skip to content

backport part of 4915: Deprecate weight constructors#5082

Closed
tcharding wants to merge 1 commit intorust-bitcoin:0.32.xfrom
tcharding:push-yvzzurrousvt
Closed

backport part of 4915: Deprecate weight constructors#5082
tcharding wants to merge 1 commit intorust-bitcoin:0.32.xfrom
tcharding:push-yvzzurrousvt

Conversation

@tcharding
Copy link
Copy Markdown
Member

@tcharding tcharding commented Oct 3, 2025

Deprecation in trait methods is painful and these two weight constructors are now defined in TxInExt.

In #4915 we deprecate Weight::from_non_witness_data_size and Weight::from_witness_data_size in favour of Weight::from_vb and Weight::from_wu respectively but doing so messes with the APIs of these to TxIn methods because the return value changes from Weight to Option<Weight>.

Deprecate the functions here so we can either break the API in 0.33 or delete the functions entirely.

Note this only does the stuff from 4915 in bitcoin not in units.

@github-actions github-actions bot added the C-bitcoin PRs modifying the bitcoin crate label Oct 3, 2025
@tcharding tcharding changed the title backport 4915: Deprecate weight constructors backport part of 4915: Deprecate weight constructors Oct 3, 2025
Deprecation in trait methods is painful and these two weight
constructors are now defined in `TxInExt`.

In rust-bitcoin#4915 we deprecate `Weight::from_non_witness_data_size` and
`Weight::from_witness_data_size` in favour of `Weight::from_vb` and
`Weight::from_wu` respectively but doing so messes with the APIs of
these to `TxIn` methods because the return value changes from `Weight`
to `Option<Weight>`.

Deprecate the functions here so we can either break the API in 0.33 or
delete the functions entirely.

Note this only does the stuff from 4915 in `bitcoin` not in `units`.
@apoelstra
Copy link
Copy Markdown
Member

See my comment on #4915 -- I think we need to also add replacement methods since currently there aren't really any, so users can't take action based on this deprecation notice.

@tcharding
Copy link
Copy Markdown
Member Author

You mean the conversation starting here, right: #4915 (comment)

My interpretation of that convo is just to close this PR and do the break on master.

@apoelstra
Copy link
Copy Markdown
Member

Yep, that's the conversation I mean. And yes, agreed, you've convinced me.

@apoelstra apoelstra closed this Oct 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C-bitcoin PRs modifying the bitcoin crate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants