feat: update wallet::Balance to use bitcoin::Amount

- update all fields `immature`, ` trusted_pending`, `unstrusted_pending`
  and `confirmed` to use the `bitcoin::Amount` instead of `u64`
- update all `impl Balance` methods to use `bitcoin::Amount`
- update all tests that relies on `keychain::Balance`
This commit is contained in:
Leonardo Lima
2024-04-24 18:12:45 -03:00
parent 08fac47c29
commit 8a33d98db9
15 changed files with 127 additions and 120 deletions

View File

@@ -78,7 +78,7 @@ fn scan_detects_confirmed_tx() -> Result<()> {
assert_eq!(
get_balance(&recv_chain, &recv_graph)?,
Balance {
confirmed: SEND_AMOUNT.to_sat(),
confirmed: SEND_AMOUNT,
..Balance::default()
},
);
@@ -147,7 +147,7 @@ fn tx_can_become_unconfirmed_after_reorg() -> Result<()> {
assert_eq!(
get_balance(&recv_chain, &recv_graph)?,
Balance {
confirmed: SEND_AMOUNT.to_sat() * REORG_COUNT as u64,
confirmed: SEND_AMOUNT * REORG_COUNT as u64,
..Balance::default()
},
"initial balance must be correct",
@@ -178,8 +178,8 @@ fn tx_can_become_unconfirmed_after_reorg() -> Result<()> {
assert_eq!(
get_balance(&recv_chain, &recv_graph)?,
Balance {
confirmed: SEND_AMOUNT.to_sat() * (REORG_COUNT - depth) as u64,
trusted_pending: SEND_AMOUNT.to_sat() * depth as u64,
confirmed: SEND_AMOUNT * (REORG_COUNT - depth) as u64,
trusted_pending: SEND_AMOUNT * depth as u64,
..Balance::default()
},
"reorg_count: {}",