feat: use Amount on calculate_fee, fee_absolute, fee_amount and others

- update to use `bitcoin::Amount` on `CreateTxError::FeeTooLow` variant.
- update to use `bitcoin::Amount` on `Wallet::calculate_fee()`.
- update to use `bitcoin::Amount` on `FeePolicy::fee_absolute()`.
- update to use `bitcoin::SignedAmount` on
  `CalculateFeeError::NegativeFee` variant.
- update to use `bitcoin::Amount` on `TxGraph::calculate_fee()`.
- update to use `bitcoin::Amount` on `PsbUtils::fee_amount()`
This commit is contained in:
Leonardo Lima
2024-05-05 17:41:31 -03:00
parent 4a8452f9b8
commit a03949adb0
10 changed files with 113 additions and 118 deletions

View File

@@ -101,7 +101,8 @@ fn scan_detects_confirmed_tx() -> anyhow::Result<()> {
.fee
.expect("Fee must exist")
.abs()
.to_sat() as u64;
.to_unsigned()
.expect("valid `SignedAmount`");
// Check that the calculated fee matches the fee from the transaction data.
assert_eq!(fee, tx_fee);