-
Notifications
You must be signed in to change notification settings - Fork 312
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
fix: remove deprecated max_satisfaction_weight
#1115
fix: remove deprecated max_satisfaction_weight
#1115
Conversation
max_satisfaction_weight
I'm pretty sure that adding a +4 is not enough to make the code correct, but proving it isn't as easy as I thought. Adding +4 is fine for segwit transactions, but it's not for legacy ones. Looking at the bdk txbuilding tests, it seems to me that we never test with legacy descriptors: bdk/crates/bdk/tests/common.rs Lines 111 to 156 in 43fb0b2
This should be improved. I tried to quickly add a I would tackle this issue in steps:
bdk/crates/bdk/src/wallet/coin_selection.rs Line 311 in 43fb0b2
We should instead have different constants (I think you can just use Just a small note: I understand that this issue is much bigger and more complicated than what it seemed. Feel free to ask for help when/if you need it, and to solve only parts of it (ex: only improve the testing framework) if you think it's best :) |
I totally agree with you.
Yes, also agree that this is step 1.
Yes, sure thanks. This PR could also be more than 2 hands.
I was exactly thinking that. |
I think the more people work on it, the harder it gets to communicate what needs to be done. Ofc many can help with reviews, but I'll let you do the code if you feel up for it :)
I was initially thinking of some kind of Matching on the DescriptorType is a good start (see https://docs.rs/miniscript/latest/miniscript/descriptor/enum.DescriptorType.html#method.segwit_version), but unfortunately not enough, as you also need to consider foreign utxos (consider a user with a legacy descriptor, adding a segwit foreign utxo). One thing we might want to do is to consider all txs to be segwit by default, but then the user can customize this using a However, I don't think this is a clean solution, it seems quite hacky and not really clear for the user. We could also:
Thoughts? cc @evanlinjin @LLFourn |
That is also valid, this was deprecated in Jan 2023 (see rust-bitcoin/rust-miniscript#476). |
b902be2
to
e6185d6
Compare
- Change deprecated `max_satisfaction_weight` to `max_weight_to_satisfy` - Remove `#[allow(deprecated)]` flags
e6185d6
to
1139065
Compare
This one needs a rebase after alpha.5 release. |
I'm taking over this in a new PR with some tweaks and a rebase |
798ed8c fix: remove deprecated `max_satisfaction_weight (Jose Storopoli) Pull request description: ### Description Continuation of #1115. Closes #1036. * Change deprecated `max_satisfaction_weight` to `max_weight_to_satisfy` * Remove `#[allow(deprecated)]` flags ### Notes to the reviewers I've changed all `max_satisfaction_weight()` to `max_weight_to_satisfy()` in `Wallet.get_available_utxo()` and `Wallet.build_fee_bump()`. Checking the docs on the `miniscript` crate for `max_weight_to_satisfy` has the following note: We are testing if the underlying descriptor `is.segwit()` or `.is_taproot`, then adding 4WU if true or leaving as it is otherwise. Another thing, we are not testing in BDK tests for legacy (pre-segwit) descriptors. Should I also add them to this PR? ### Changelog notice ### Fixed Replace the deprecated `max_satisfaction_weight` from `rust-miniscript` to `max_weight_to_satisfy`. ### Checklists #### All Submissions: * [x] I've signed all my commits * [x] I followed the [contribution guidelines](https://github.com/bitcoindevkit/bdk/blob/master/CONTRIBUTING.md) * [x] I ran `cargo fmt` and `cargo clippy` before committing #### Bugfixes: * [ ] This pull request breaks the existing API * [ ] I've added tests to reproduce the issue which are now passing * [x] I'm linking the issue being fixed by this PR ACKs for top commit: evanlinjin: ACK 798ed8c Tree-SHA512: 60babecee13c24915348ddb64894127a76a59d9421d52ea37acc714913685d57cc2be1904f9d0508078dd1db1f7d7dad83a734af5ee981801ca87de2e9984429
Description
Closes #1036.
max_satisfaction_weight
tomax_weight_to_satisfy
#[allow(deprecated)]
flagsNotes to the reviewers
I've changed all
max_satisfaction_weight()
tomax_weight_to_satisfy()
in
Wallet.get_available_utxo()
andWallet.build_fee_bump()
.Checking the docs on the
miniscript
crate formax_weight_to_satisfy
has the following note:Hence, I also added 1WU (
4
) to themax_weight_to_satisfy()
calls.But I think that there is a better way to do this instead of hardcoding
4
.Please advise.
Changelog notice
Fixed
Replace the deprecated
max_satisfaction_weight
fromrust-miniscript
tomax_weight_to_satisfy
.Checklists
All Submissions:
cargo fmt
andcargo clippy
before committingBugfixes: