mirror of
https://github.com/comit-network/xmr-btc-swap.git
synced 2024-10-31 15:20:15 +00:00
Rename config to execution_params
This commit is contained in:
parent
802dc61e7e
commit
89b3775e05
@ -10,7 +10,7 @@ pub use ::bitcoin::{util::amount::Amount, Address, Network, Transaction, Txid};
|
||||
pub use ecdsa_fun::{adaptor::EncryptedSignature, fun::Scalar, Signature};
|
||||
pub use wallet::Wallet;
|
||||
|
||||
use crate::{bitcoin::timelocks::BlockHeight, config::ExecutionParams};
|
||||
use crate::{bitcoin::timelocks::BlockHeight, execution_params::ExecutionParams};
|
||||
use ::bitcoin::{
|
||||
hashes::{hex::ToHex, Hash},
|
||||
secp256k1,
|
||||
|
@ -4,7 +4,7 @@ use crate::{
|
||||
GetBlockHeight, GetNetwork, GetRawTransaction, SignTxLock, Transaction,
|
||||
TransactionBlockHeight, TxLock, WaitForTransactionFinality, WatchForRawTransaction,
|
||||
},
|
||||
config::ExecutionParams,
|
||||
execution_params::ExecutionParams,
|
||||
};
|
||||
use ::bitcoin::{util::psbt::PartiallySignedTransaction, Txid};
|
||||
use anyhow::{Context, Result};
|
||||
|
@ -65,7 +65,7 @@ impl GetExecutionParams for Regtest {
|
||||
}
|
||||
|
||||
mod mainnet {
|
||||
use crate::config::*;
|
||||
use crate::execution_params::*;
|
||||
|
||||
// For each step, we are giving Bob 10 minutes to act.
|
||||
pub static BOB_TIME_TO_ACT: Lazy<Duration> = Lazy::new(|| Duration::from_secs(10 * 60));
|
||||
@ -82,7 +82,7 @@ mod mainnet {
|
||||
}
|
||||
|
||||
mod testnet {
|
||||
use crate::config::*;
|
||||
use crate::execution_params::*;
|
||||
|
||||
pub static BOB_TIME_TO_ACT: Lazy<Duration> = Lazy::new(|| Duration::from_secs(60 * 60));
|
||||
|
||||
@ -100,7 +100,7 @@ mod testnet {
|
||||
}
|
||||
|
||||
mod regtest {
|
||||
use crate::config::*;
|
||||
use crate::execution_params::*;
|
||||
|
||||
// In test, we set a shorter time to fail fast
|
||||
pub static BOB_TIME_TO_ACT: Lazy<Duration> = Lazy::new(|| Duration::from_secs(30));
|
@ -17,8 +17,8 @@
|
||||
)]
|
||||
|
||||
pub mod bitcoin;
|
||||
pub mod config;
|
||||
pub mod database;
|
||||
pub mod execution_params;
|
||||
pub mod monero;
|
||||
pub mod network;
|
||||
pub mod protocol;
|
||||
|
@ -14,10 +14,10 @@
|
||||
|
||||
use crate::{
|
||||
cli::{Command, Options, Resume},
|
||||
config::GetExecutionParams,
|
||||
configuration::{
|
||||
initial_setup, query_user_for_initial_testnet_config, read_config, ConfigNotInitialized,
|
||||
},
|
||||
execution_params::GetExecutionParams,
|
||||
};
|
||||
use anyhow::{Context, Result};
|
||||
use database::Database;
|
||||
@ -32,9 +32,9 @@ use tracing::info;
|
||||
use uuid::Uuid;
|
||||
|
||||
pub mod bitcoin;
|
||||
pub mod config;
|
||||
pub mod configuration;
|
||||
pub mod database;
|
||||
pub mod execution_params;
|
||||
pub mod monero;
|
||||
pub mod network;
|
||||
pub mod protocol;
|
||||
@ -73,7 +73,7 @@ async fn main() -> Result<()> {
|
||||
// hardcode to testnet/stagenet
|
||||
let bitcoin_network = bitcoin::Network::Testnet;
|
||||
let monero_network = monero::Network::Stagenet;
|
||||
let execution_params = config::Testnet::get_execution_params();
|
||||
let execution_params = execution_params::Testnet::get_execution_params();
|
||||
|
||||
match opt.cmd {
|
||||
Command::SellXmr {
|
||||
|
@ -10,10 +10,9 @@ pub use self::{
|
||||
transfer_proof::TransferProof,
|
||||
};
|
||||
use crate::{
|
||||
bitcoin,
|
||||
config::ExecutionParams,
|
||||
database,
|
||||
bitcoin, database,
|
||||
database::Database,
|
||||
execution_params::ExecutionParams,
|
||||
monero,
|
||||
network::{
|
||||
peer_tracker::{self, PeerTracker},
|
||||
|
@ -7,7 +7,7 @@ use crate::{
|
||||
TransactionBlockHeight, TxCancel, TxLock, TxRefund, WaitForTransactionFinality,
|
||||
WatchForRawTransaction,
|
||||
},
|
||||
config::ExecutionParams,
|
||||
execution_params::ExecutionParams,
|
||||
monero,
|
||||
monero::Transfer,
|
||||
protocol::{
|
||||
|
@ -6,9 +6,9 @@ use crate::{
|
||||
timelocks::ExpiredTimelocks, TransactionBlockHeight, WaitForTransactionFinality,
|
||||
WatchForRawTransaction,
|
||||
},
|
||||
config::ExecutionParams,
|
||||
database,
|
||||
database::Database,
|
||||
execution_params::ExecutionParams,
|
||||
monero,
|
||||
monero::CreateWalletForOutput,
|
||||
protocol::{
|
||||
|
@ -28,7 +28,7 @@ pub use self::{
|
||||
swap::{run, run_until},
|
||||
swap_request::*,
|
||||
};
|
||||
use crate::{config::ExecutionParams, protocol::alice::TransferProof};
|
||||
use crate::{execution_params::ExecutionParams, protocol::alice::TransferProof};
|
||||
|
||||
mod encrypted_signature;
|
||||
pub mod event_loop;
|
||||
|
@ -6,7 +6,7 @@ use crate::{
|
||||
GetBlockHeight, GetNetwork, GetRawTransaction, Transaction, TransactionBlockHeight,
|
||||
TxCancel, Txid, WatchForRawTransaction,
|
||||
},
|
||||
config::ExecutionParams,
|
||||
execution_params::ExecutionParams,
|
||||
monero,
|
||||
monero::{monero_private_key, TransferProof},
|
||||
protocol::{alice, bob, bob::EncryptedSignature, SwapAmounts},
|
||||
|
@ -1,8 +1,8 @@
|
||||
use crate::{
|
||||
bitcoin,
|
||||
bitcoin::timelocks::ExpiredTimelocks,
|
||||
config::ExecutionParams,
|
||||
database::{Database, Swap},
|
||||
execution_params::ExecutionParams,
|
||||
monero,
|
||||
protocol::{
|
||||
bob::{self, event_loop::EventLoopHandle, state::*, SwapRequest},
|
||||
|
@ -1,7 +1,7 @@
|
||||
pub mod testutils;
|
||||
|
||||
use swap::{
|
||||
config,
|
||||
execution_params,
|
||||
protocol::{alice, alice::AliceState, bob},
|
||||
};
|
||||
use testutils::alice_run_until::is_encsig_learned;
|
||||
@ -11,7 +11,7 @@ use testutils::alice_run_until::is_encsig_learned;
|
||||
/// redeem had the timelock not expired.
|
||||
#[tokio::test]
|
||||
async fn given_alice_restarts_after_enc_sig_learned_and_bob_already_cancelled_refund_swap() {
|
||||
testutils::setup_test(config::Regtest, |mut ctx| async move {
|
||||
testutils::setup_test(execution_params::Regtest, |mut ctx| async move {
|
||||
let (alice_swap, alice_join_handle) = ctx.new_swap_as_alice().await;
|
||||
let (bob_swap, _) = ctx.new_swap_as_bob().await;
|
||||
|
||||
|
@ -8,8 +8,8 @@ use std::{path::PathBuf, sync::Arc};
|
||||
use swap::{
|
||||
bitcoin,
|
||||
bitcoin::Timelock,
|
||||
config,
|
||||
config::{ExecutionParams, GetExecutionParams},
|
||||
execution_params,
|
||||
execution_params::{ExecutionParams, GetExecutionParams},
|
||||
monero,
|
||||
protocol::{alice, alice::AliceState, bob, bob::BobState, SwapAmounts},
|
||||
seed::Seed,
|
||||
@ -518,7 +518,7 @@ impl GetExecutionParams for SlowCancelConfig {
|
||||
fn get_execution_params() -> ExecutionParams {
|
||||
ExecutionParams {
|
||||
bitcoin_cancel_timelock: Timelock::new(180),
|
||||
..config::Regtest::get_execution_params()
|
||||
..execution_params::Regtest::get_execution_params()
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -529,7 +529,7 @@ impl GetExecutionParams for FastCancelConfig {
|
||||
fn get_execution_params() -> ExecutionParams {
|
||||
ExecutionParams {
|
||||
bitcoin_cancel_timelock: Timelock::new(1),
|
||||
..config::Regtest::get_execution_params()
|
||||
..execution_params::Regtest::get_execution_params()
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -541,7 +541,7 @@ impl GetExecutionParams for FastPunishConfig {
|
||||
ExecutionParams {
|
||||
bitcoin_cancel_timelock: Timelock::new(1),
|
||||
bitcoin_punish_timelock: Timelock::new(1),
|
||||
..config::Regtest::get_execution_params()
|
||||
..execution_params::Regtest::get_execution_params()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user