Rename weight constants.

This commit is contained in:
Philipp Hoenisch 2021-05-01 10:16:16 +10:00
parent ee90c228b4
commit 9e8b788aa9
No known key found for this signature in database
GPG Key ID: E5F8E74C672BC666
4 changed files with 16 additions and 16 deletions

View File

@ -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 {

View File

@ -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,

View File

@ -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(

View File

@ -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