diff --git a/swap/src/bitcoin.rs b/swap/src/bitcoin.rs index 8df65e05..e7b9b2bf 100644 --- a/swap/src/bitcoin.rs +++ b/swap/src/bitcoin.rs @@ -37,10 +37,10 @@ use serde::{Deserialize, Serialize}; use sha2::Sha256; use std::str::FromStr; -pub use crate::bitcoin::cancel::ESTIMATED_WEIGHT as ESTIMATED_WEIGHT_TX_CANCEL; -pub use crate::bitcoin::punish::ESTIMATED_WEIGHT as ESTIMATED_WEIGHT_TX_PUNISH; -pub use crate::bitcoin::redeem::ESTIMATED_WEIGHT as ESTIMATED_WEIGHT_TX_REDEEM; -pub use crate::bitcoin::refund::ESTIMATED_WEIGHT as ESTIMATED_WEIGHT_TX_REFUND; +pub use crate::bitcoin::cancel::ESTIMATED_WEIGHT as TX_CANCEL_ESTIMATED_WEIGHT; +pub use crate::bitcoin::punish::ESTIMATED_WEIGHT as TX_PUNISH_ESTIMATED_WEIGHT; +pub use crate::bitcoin::redeem::ESTIMATED_WEIGHT as TX_REDEEM_ESTIMATED_WEIGHT; +pub use crate::bitcoin::refund::ESTIMATED_WEIGHT as TX_REFUND_ESTIMATED_WEIGHT; #[derive(Debug, Clone, Deserialize, Serialize, PartialEq)] pub struct SecretKey { diff --git a/swap/src/protocol/alice/state.rs b/swap/src/protocol/alice/state.rs index d177f10f..4e3f6b41 100644 --- a/swap/src/protocol/alice/state.rs +++ b/swap/src/protocol/alice/state.rs @@ -1,6 +1,6 @@ use crate::bitcoin::{ current_epoch, CancelTimelock, ExpiredTimelocks, PunishTimelock, TxCancel, TxPunish, TxRefund, - ESTIMATED_WEIGHT_TX_PUNISH, ESTIMATED_WEIGHT_TX_REDEEM, + TX_PUNISH_ESTIMATED_WEIGHT, TX_REDEEM_ESTIMATED_WEIGHT, }; use crate::env::Config; use crate::monero::wallet::{TransferRequest, WatchRequest}; @@ -133,10 +133,10 @@ impl State0 { let (dleq_proof_s_a, (S_a_bitcoin, S_a_monero)) = CROSS_CURVE_PROOF_SYSTEM.prove(&s_a, rng); let tx_redeem_fee = bitcoin_wallet - .estimate_fee(ESTIMATED_WEIGHT_TX_REDEEM) + .estimate_fee(TX_REDEEM_ESTIMATED_WEIGHT) .await?; let tx_punish_fee = bitcoin_wallet - .estimate_fee(ESTIMATED_WEIGHT_TX_PUNISH) + .estimate_fee(TX_PUNISH_ESTIMATED_WEIGHT) .await?; Ok(Self { a, diff --git a/swap/src/protocol/bob/swap.rs b/swap/src/protocol/bob/swap.rs index 5bd2a0df..12900e52 100644 --- a/swap/src/protocol/bob/swap.rs +++ b/swap/src/protocol/bob/swap.rs @@ -67,10 +67,10 @@ async fn next_state( BobState::Started { btc_amount } => { let bitcoin_refund_address = bitcoin_wallet.new_address().await?; let tx_refund_fee = bitcoin_wallet - .estimate_fee(bitcoin::ESTIMATED_WEIGHT_TX_REDEEM) + .estimate_fee(bitcoin::TX_REFUND_ESTIMATED_WEIGHT) .await?; let tx_cancel_fee = bitcoin_wallet - .estimate_fee(bitcoin::ESTIMATED_WEIGHT_TX_CANCEL) + .estimate_fee(bitcoin::TX_CANCEL_ESTIMATED_WEIGHT) .await?; let state2 = request_price_and_setup( diff --git a/swap/tests/harness/mod.rs b/swap/tests/harness/mod.rs index 66f08821..4b9f988c 100644 --- a/swap/tests/harness/mod.rs +++ b/swap/tests/harness/mod.rs @@ -15,8 +15,8 @@ use std::path::{Path, PathBuf}; use std::sync::Arc; use std::time::Duration; use swap::bitcoin::{ - CancelTimelock, PunishTimelock, ESTIMATED_WEIGHT_TX_CANCEL, ESTIMATED_WEIGHT_TX_REDEEM, - ESTIMATED_WEIGHT_TX_REFUND, + CancelTimelock, PunishTimelock, TX_CANCEL_ESTIMATED_WEIGHT, TX_PUNISH_ESTIMATED_WEIGHT, + TX_REDEEM_ESTIMATED_WEIGHT, TX_REFUND_ESTIMATED_WEIGHT, }; use swap::database::Database; use swap::env::{Config, GetConfig}; @@ -637,12 +637,12 @@ impl TestContext { let cancel_fee = self .alice_bitcoin_wallet - .estimate_fee(ESTIMATED_WEIGHT_TX_CANCEL) + .estimate_fee(TX_CANCEL_ESTIMATED_WEIGHT) .await .expect("To estimate fee correctly"); let refund_fee = self .alice_bitcoin_wallet - .estimate_fee(ESTIMATED_WEIGHT_TX_REFUND) + .estimate_fee(TX_REFUND_ESTIMATED_WEIGHT) .await .expect("To estimate fee correctly"); @@ -685,7 +685,7 @@ impl TestContext { async fn alice_redeemed_btc_balance(&self) -> bitcoin::Amount { let fee = self .alice_bitcoin_wallet - .estimate_fee(ESTIMATED_WEIGHT_TX_REDEEM) + .estimate_fee(TX_REDEEM_ESTIMATED_WEIGHT) .await .expect("To estimate fee correctly"); self.alice_starting_balances.btc + self.btc_amount - fee @@ -728,12 +728,12 @@ impl TestContext { async fn alice_punished_btc_balance(&self) -> bitcoin::Amount { let cancel_fee = self .alice_bitcoin_wallet - .estimate_fee(ESTIMATED_WEIGHT_TX_CANCEL) + .estimate_fee(TX_CANCEL_ESTIMATED_WEIGHT) .await .expect("To estimate fee correctly"); let punish_fee = self .alice_bitcoin_wallet - .estimate_fee(ESTIMATED_WEIGHT_TX_REFUND) + .estimate_fee(TX_PUNISH_ESTIMATED_WEIGHT) .await .expect("To estimate fee correctly"); self.alice_starting_balances.btc + self.btc_amount - cancel_fee - punish_fee