bdk icon indicating copy to clipboard operation
bdk copied to clipboard

fix: remove deprecated max_satisfaction_weight

Open storopoli opened this issue 1 year ago • 5 comments

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
  • [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

storopoli avatar Feb 15 '24 11:02 storopoli

Can I please have some input on my statement here? Thanks!

I think it's okay to assume all transactions are segwit transactions for now? Unless if someone can figure out how to take away the witness len elegantly (for non-segwit txs).

evanlinjin avatar Mar 01 '24 09:03 evanlinjin

I think it's okay to assume all transactions are segwit transactions for now? Unless if someone can figure out how to take away the witness len elegantly (for non-segwit txs).

I agree. We currently don't test any non-segwit tx anyways...

storopoli avatar Mar 01 '24 10:03 storopoli

I think it's okay to assume all transactions are segwit transactions for now? Unless if someone can figure out how to take away the witness len elegantly (for non-segwit txs).

Because we already assume this:

https://github.com/bitcoindevkit/bdk/blob/master/crates%2Fbdk%2Fsrc%2Fwallet%2Fmod.rs#L1505-L1513

So I think it is okay.

evanlinjin avatar Mar 01 '24 19:03 evanlinjin

@storopoli can we please rebase the two commits into one and I'll ACK it.

evanlinjin avatar Mar 01 '24 19:03 evanlinjin

@storopoli can we please rebase the two commits into one and I'll ACK it.

Done, thanks mate!

storopoli avatar Mar 02 '24 10:03 storopoli

@storopoli sorry can you do a rebase on master? thanks

evanlinjin avatar Mar 22 '24 04:03 evanlinjin

@storopoli sorry can you do a rebase on master? thanks

Don't worry man. Sure, rebased to master :)

storopoli avatar Mar 22 '24 07:03 storopoli