refactor(bdk): display CreateTxError::FeeRateTooLow in sat/vb

Also modify a unit test `test_bump_fee_low_fee_rate` to
additionally assert the expected error message
This commit is contained in:
vmammal
2023-11-16 18:13:44 -05:00
parent 09bd86e2d8
commit 89608ddd0f
3 changed files with 28 additions and 5 deletions

View File

@@ -2563,6 +2563,17 @@ fn create_signers<E: IntoWalletDescriptor>(
Ok((signers, change_signers))
}
/// Transforms a [`FeeRate`] to `f64` with unit as sat/vb.
#[macro_export]
#[doc(hidden)]
macro_rules! floating_rate {
($rate:expr) => {{
use $crate::bitcoin::blockdata::constants::WITNESS_SCALE_FACTOR;
// sat_kwu / 250.0 -> sat_vb
$rate.to_sat_per_kwu() as f64 / ((1000 / WITNESS_SCALE_FACTOR) as f64)
}};
}
#[macro_export]
#[doc(hidden)]
/// Macro for getting a wallet for use in a doctest