bdk icon indicating copy to clipboard operation
bdk copied to clipboard

Add absolute fee and fee rate sanity check in the Wallet API

Open notmandatory opened this issue 1 year ago • 3 comments

Describe the enhancement

A BDK wallet should check the absolute transaction fee and free rate when creating, and/or signing a transaction PSBT. There should also be a way to change or disable this fee rate check. I suggest we should make the maximum absolute fee the same as bitcoin core (0.1 BTC), and fee rate the same as what Liana chose (1_000 sats/vb), but defaults are open for discussion.

Use case

This would prevent BDK users from accidentally creating and signing transactions with very large, unreasonable transaction fees. This feature would improve our feature parity with the bitcoin core wallet.

Additional context

Discord comment from @darosior:

For what it's worth in Liana we have both an absolute fee (1BTC) and feerate (1_000 sat/vb) sanity checks: https://github.com/wizardsardine/liana/blob/7bfc53890aa1466b0fee413d7373cbd05fd22a19/src/commands/mod.rs#L213-L238. Bitcoin Core has a 0.1BTC maximum absolute fee sanity check iirc, but you can tweak it. I agree BDK should have one. Any wallet software intended to be used with real funds should have such sanity checks.

notmandatory avatar Nov 28 '23 20:11 notmandatory

Assigned to 1.1 for the moment (during Lib Team Call)

nondiremanuel avatar Dec 05 '23 12:12 nondiremanuel

Another creative approach would be to warn if the fee exceeds a fixed % of the total send amount

ValuedMammal avatar Jan 07 '24 19:01 ValuedMammal

It seems rust-bitcoin added something along these lines in their latest release.

-------- Original Message -------- On Jan 7, 2024, 8:42 PM, ValuedMammal wrote:

Another creative approach would be to warn if the fee exceeds a fixed % of the total send amount

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>

darosior avatar Jan 07 '24 20:01 darosior