mirror of
https://github.com/comit-network/xmr-btc-swap.git
synced 2024-10-01 01:45:40 -04:00
Rename weight constants.
This commit is contained in:
parent
ee90c228b4
commit
9e8b788aa9
@ -37,10 +37,10 @@ use serde::{Deserialize, Serialize};
|
|||||||
use sha2::Sha256;
|
use sha2::Sha256;
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
|
|
||||||
pub use crate::bitcoin::cancel::ESTIMATED_WEIGHT as ESTIMATED_WEIGHT_TX_CANCEL;
|
pub use crate::bitcoin::cancel::ESTIMATED_WEIGHT as TX_CANCEL_ESTIMATED_WEIGHT;
|
||||||
pub use crate::bitcoin::punish::ESTIMATED_WEIGHT as ESTIMATED_WEIGHT_TX_PUNISH;
|
pub use crate::bitcoin::punish::ESTIMATED_WEIGHT as TX_PUNISH_ESTIMATED_WEIGHT;
|
||||||
pub use crate::bitcoin::redeem::ESTIMATED_WEIGHT as ESTIMATED_WEIGHT_TX_REDEEM;
|
pub use crate::bitcoin::redeem::ESTIMATED_WEIGHT as TX_REDEEM_ESTIMATED_WEIGHT;
|
||||||
pub use crate::bitcoin::refund::ESTIMATED_WEIGHT as ESTIMATED_WEIGHT_TX_REFUND;
|
pub use crate::bitcoin::refund::ESTIMATED_WEIGHT as TX_REFUND_ESTIMATED_WEIGHT;
|
||||||
|
|
||||||
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq)]
|
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq)]
|
||||||
pub struct SecretKey {
|
pub struct SecretKey {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
use crate::bitcoin::{
|
use crate::bitcoin::{
|
||||||
current_epoch, CancelTimelock, ExpiredTimelocks, PunishTimelock, TxCancel, TxPunish, TxRefund,
|
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::env::Config;
|
||||||
use crate::monero::wallet::{TransferRequest, WatchRequest};
|
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 (dleq_proof_s_a, (S_a_bitcoin, S_a_monero)) = CROSS_CURVE_PROOF_SYSTEM.prove(&s_a, rng);
|
||||||
|
|
||||||
let tx_redeem_fee = bitcoin_wallet
|
let tx_redeem_fee = bitcoin_wallet
|
||||||
.estimate_fee(ESTIMATED_WEIGHT_TX_REDEEM)
|
.estimate_fee(TX_REDEEM_ESTIMATED_WEIGHT)
|
||||||
.await?;
|
.await?;
|
||||||
let tx_punish_fee = bitcoin_wallet
|
let tx_punish_fee = bitcoin_wallet
|
||||||
.estimate_fee(ESTIMATED_WEIGHT_TX_PUNISH)
|
.estimate_fee(TX_PUNISH_ESTIMATED_WEIGHT)
|
||||||
.await?;
|
.await?;
|
||||||
Ok(Self {
|
Ok(Self {
|
||||||
a,
|
a,
|
||||||
|
@ -67,10 +67,10 @@ async fn next_state(
|
|||||||
BobState::Started { btc_amount } => {
|
BobState::Started { btc_amount } => {
|
||||||
let bitcoin_refund_address = bitcoin_wallet.new_address().await?;
|
let bitcoin_refund_address = bitcoin_wallet.new_address().await?;
|
||||||
let tx_refund_fee = bitcoin_wallet
|
let tx_refund_fee = bitcoin_wallet
|
||||||
.estimate_fee(bitcoin::ESTIMATED_WEIGHT_TX_REDEEM)
|
.estimate_fee(bitcoin::TX_REFUND_ESTIMATED_WEIGHT)
|
||||||
.await?;
|
.await?;
|
||||||
let tx_cancel_fee = bitcoin_wallet
|
let tx_cancel_fee = bitcoin_wallet
|
||||||
.estimate_fee(bitcoin::ESTIMATED_WEIGHT_TX_CANCEL)
|
.estimate_fee(bitcoin::TX_CANCEL_ESTIMATED_WEIGHT)
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
let state2 = request_price_and_setup(
|
let state2 = request_price_and_setup(
|
||||||
|
@ -15,8 +15,8 @@ use std::path::{Path, PathBuf};
|
|||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
use swap::bitcoin::{
|
use swap::bitcoin::{
|
||||||
CancelTimelock, PunishTimelock, ESTIMATED_WEIGHT_TX_CANCEL, ESTIMATED_WEIGHT_TX_REDEEM,
|
CancelTimelock, PunishTimelock, TX_CANCEL_ESTIMATED_WEIGHT, TX_PUNISH_ESTIMATED_WEIGHT,
|
||||||
ESTIMATED_WEIGHT_TX_REFUND,
|
TX_REDEEM_ESTIMATED_WEIGHT, TX_REFUND_ESTIMATED_WEIGHT,
|
||||||
};
|
};
|
||||||
use swap::database::Database;
|
use swap::database::Database;
|
||||||
use swap::env::{Config, GetConfig};
|
use swap::env::{Config, GetConfig};
|
||||||
@ -637,12 +637,12 @@ impl TestContext {
|
|||||||
|
|
||||||
let cancel_fee = self
|
let cancel_fee = self
|
||||||
.alice_bitcoin_wallet
|
.alice_bitcoin_wallet
|
||||||
.estimate_fee(ESTIMATED_WEIGHT_TX_CANCEL)
|
.estimate_fee(TX_CANCEL_ESTIMATED_WEIGHT)
|
||||||
.await
|
.await
|
||||||
.expect("To estimate fee correctly");
|
.expect("To estimate fee correctly");
|
||||||
let refund_fee = self
|
let refund_fee = self
|
||||||
.alice_bitcoin_wallet
|
.alice_bitcoin_wallet
|
||||||
.estimate_fee(ESTIMATED_WEIGHT_TX_REFUND)
|
.estimate_fee(TX_REFUND_ESTIMATED_WEIGHT)
|
||||||
.await
|
.await
|
||||||
.expect("To estimate fee correctly");
|
.expect("To estimate fee correctly");
|
||||||
|
|
||||||
@ -685,7 +685,7 @@ impl TestContext {
|
|||||||
async fn alice_redeemed_btc_balance(&self) -> bitcoin::Amount {
|
async fn alice_redeemed_btc_balance(&self) -> bitcoin::Amount {
|
||||||
let fee = self
|
let fee = self
|
||||||
.alice_bitcoin_wallet
|
.alice_bitcoin_wallet
|
||||||
.estimate_fee(ESTIMATED_WEIGHT_TX_REDEEM)
|
.estimate_fee(TX_REDEEM_ESTIMATED_WEIGHT)
|
||||||
.await
|
.await
|
||||||
.expect("To estimate fee correctly");
|
.expect("To estimate fee correctly");
|
||||||
self.alice_starting_balances.btc + self.btc_amount - fee
|
self.alice_starting_balances.btc + self.btc_amount - fee
|
||||||
@ -728,12 +728,12 @@ impl TestContext {
|
|||||||
async fn alice_punished_btc_balance(&self) -> bitcoin::Amount {
|
async fn alice_punished_btc_balance(&self) -> bitcoin::Amount {
|
||||||
let cancel_fee = self
|
let cancel_fee = self
|
||||||
.alice_bitcoin_wallet
|
.alice_bitcoin_wallet
|
||||||
.estimate_fee(ESTIMATED_WEIGHT_TX_CANCEL)
|
.estimate_fee(TX_CANCEL_ESTIMATED_WEIGHT)
|
||||||
.await
|
.await
|
||||||
.expect("To estimate fee correctly");
|
.expect("To estimate fee correctly");
|
||||||
let punish_fee = self
|
let punish_fee = self
|
||||||
.alice_bitcoin_wallet
|
.alice_bitcoin_wallet
|
||||||
.estimate_fee(ESTIMATED_WEIGHT_TX_REFUND)
|
.estimate_fee(TX_PUNISH_ESTIMATED_WEIGHT)
|
||||||
.await
|
.await
|
||||||
.expect("To estimate fee correctly");
|
.expect("To estimate fee correctly");
|
||||||
self.alice_starting_balances.btc + self.btc_amount - cancel_fee - punish_fee
|
self.alice_starting_balances.btc + self.btc_amount - cancel_fee - punish_fee
|
||||||
|
Loading…
Reference in New Issue
Block a user