diff --git a/Cargo.lock b/Cargo.lock index 8e3d4fe5..80dbd88a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -183,12 +183,6 @@ dependencies = [ "tokio", ] -[[package]] -name = "base-x" -version = "0.2.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4521f3e3d031370679b3b140beb36dfe4801b09ac77e30c61941f97df3ef28b" - [[package]] name = "base32" version = "0.4.0" @@ -681,12 +675,6 @@ dependencies = [ "winapi 0.3.9", ] -[[package]] -name = "const_fn" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28b9d6de7f49e22cf97ad17fc4036ece69300032f45f78f30b4a4482cdc3f4a6" - [[package]] name = "core-foundation" version = "0.9.1" @@ -975,12 +963,6 @@ dependencies = [ "winapi 0.3.9", ] -[[package]] -name = "discard" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "212d0f5754cb6769937f4501cc0e67f4f4483c8d2c3e1e922ee9edbe4ab4c7c0" - [[package]] name = "ecdsa_fun" version = "0.6.2-alpha.0" @@ -3753,12 +3735,6 @@ dependencies = [ "opaque-debug 0.3.0", ] -[[package]] -name = "sha1" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2579985fda508104f7587689507983eadd6a6e84dd35d6d115361f530916fa0d" - [[package]] name = "sha2" version = "0.8.2" @@ -3965,70 +3941,12 @@ version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" -[[package]] -name = "standback" -version = "0.2.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2beb4d1860a61f571530b3f855a1b538d0200f7871c63331ecd6f17b1f014f8" -dependencies = [ - "version_check 0.9.3", -] - [[package]] name = "static_assertions" version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" -[[package]] -name = "stdweb" -version = "0.4.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d022496b16281348b52d0e30ae99e01a73d737b2f45d38fed4edf79f9325a1d5" -dependencies = [ - "discard", - "rustc_version 0.2.3", - "stdweb-derive", - "stdweb-internal-macros", - "stdweb-internal-runtime", - "wasm-bindgen", -] - -[[package]] -name = "stdweb-derive" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c87a60a40fccc84bef0652345bbbbbe20a605bf5d0ce81719fc476f5c03b50ef" -dependencies = [ - "proc-macro2 1.0.27", - "quote 1.0.9", - "serde", - "serde_derive", - "syn 1.0.73", -] - -[[package]] -name = "stdweb-internal-macros" -version = "0.2.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58fa5ff6ad0d98d1ffa8cb115892b6e69d67799f6763e162a1c9db421dc22e11" -dependencies = [ - "base-x", - "proc-macro2 1.0.27", - "quote 1.0.9", - "serde", - "serde_derive", - "serde_json", - "sha1", - "syn 1.0.73", -] - -[[package]] -name = "stdweb-internal-runtime" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "213701ba3370744dcd1a12960caa4843b3d68b4d1c0a5d575e0d65b2ee9d16c0" - [[package]] name = "strsim" version = "0.8.0" @@ -4160,7 +4078,7 @@ dependencies = [ "tempfile", "testcontainers 0.12.0", "thiserror", - "time 0.2.27", + "time 0.3.2", "tokio", "tokio-socks", "tokio-tar", @@ -4318,40 +4236,11 @@ dependencies = [ [[package]] name = "time" -version = "0.2.27" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4752a97f8eebd6854ff91f1c1824cd6160626ac4bd44287f7f4ea2035a02a242" +checksum = "3e0a10c9a9fb3a5dce8c2239ed670f1a2569fcf42da035f5face1b19860d52b0" dependencies = [ - "const_fn", "libc", - "standback", - "stdweb", - "time-macros", - "version_check 0.9.3", - "winapi 0.3.9", -] - -[[package]] -name = "time-macros" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "957e9c6e26f12cb6d0dd7fc776bb67a706312e7299aed74c8dd5b17ebb27e2f1" -dependencies = [ - "proc-macro-hack", - "time-macros-impl", -] - -[[package]] -name = "time-macros-impl" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5c3be1edfad6027c69f5491cf4cb310d1a71ecd6af742788c6ff8bced86b8fa" -dependencies = [ - "proc-macro-hack", - "proc-macro2 1.0.27", - "quote 1.0.9", - "standback", - "syn 1.0.73", ] [[package]] diff --git a/swap/Cargo.toml b/swap/Cargo.toml index dbee39a1..f2f84e98 100644 --- a/swap/Cargo.toml +++ b/swap/Cargo.toml @@ -52,7 +52,7 @@ sled = "0.34" structopt = "0.3" strum = { version = "0.21", features = [ "derive" ] } thiserror = "1" -time = "0.2" +time = "0.3" tokio = { version = "1", features = [ "rt-multi-thread", "time", "macros", "sync", "process", "fs", "net" ] } tokio-socks = "0.5" tokio-tungstenite = { version = "0.15", features = [ "rustls-tls" ] } diff --git a/swap/src/env.rs b/swap/src/env.rs index e12390a8..434e9b47 100644 --- a/swap/src/env.rs +++ b/swap/src/env.rs @@ -2,7 +2,7 @@ use crate::asb; use crate::bitcoin::{CancelTimelock, PunishTimelock}; use std::cmp::max; use std::time::Duration; -use time::NumericalStdDurationShort; +use time::ext::NumericalStdDuration; #[derive(Debug, Copy, Clone, PartialEq)] pub struct Config { @@ -44,14 +44,14 @@ pub struct Regtest; impl GetConfig for Mainnet { fn get_config() -> Config { Config { - bitcoin_lock_mempool_timeout: 3.minutes(), - bitcoin_lock_confirmed_timeout: 2.hours(), + bitcoin_lock_mempool_timeout: 3.std_minutes(), + bitcoin_lock_confirmed_timeout: 2.std_hours(), bitcoin_finality_confirmations: 2, - bitcoin_avg_block_time: 10.minutes(), + bitcoin_avg_block_time: 10.std_minutes(), bitcoin_cancel_timelock: CancelTimelock::new(72), bitcoin_punish_timelock: PunishTimelock::new(72), bitcoin_network: bitcoin::Network::Bitcoin, - monero_avg_block_time: 2.minutes(), + monero_avg_block_time: 2.std_minutes(), monero_finality_confirmations: 10, monero_network: monero::Network::Mainnet, } @@ -61,14 +61,14 @@ impl GetConfig for Mainnet { impl GetConfig for Testnet { fn get_config() -> Config { Config { - bitcoin_lock_mempool_timeout: 3.minutes(), - bitcoin_lock_confirmed_timeout: 1.hours(), + bitcoin_lock_mempool_timeout: 3.std_minutes(), + bitcoin_lock_confirmed_timeout: 1.std_hours(), bitcoin_finality_confirmations: 2, - bitcoin_avg_block_time: 10.minutes(), + bitcoin_avg_block_time: 10.std_minutes(), bitcoin_cancel_timelock: CancelTimelock::new(12), bitcoin_punish_timelock: PunishTimelock::new(6), bitcoin_network: bitcoin::Network::Testnet, - monero_avg_block_time: 2.minutes(), + monero_avg_block_time: 2.std_minutes(), monero_finality_confirmations: 10, monero_network: monero::Network::Stagenet, } @@ -78,14 +78,14 @@ impl GetConfig for Testnet { impl GetConfig for Regtest { fn get_config() -> Config { Config { - bitcoin_lock_mempool_timeout: 30.seconds(), - bitcoin_lock_confirmed_timeout: 1.minutes(), + bitcoin_lock_mempool_timeout: 30.std_seconds(), + bitcoin_lock_confirmed_timeout: 1.std_minutes(), bitcoin_finality_confirmations: 1, - bitcoin_avg_block_time: 5.seconds(), + bitcoin_avg_block_time: 5.std_seconds(), bitcoin_cancel_timelock: CancelTimelock::new(100), bitcoin_punish_timelock: PunishTimelock::new(50), bitcoin_network: bitcoin::Network::Regtest, - monero_avg_block_time: 1.seconds(), + monero_avg_block_time: 1.std_seconds(), monero_finality_confirmations: 10, monero_network: monero::Network::Mainnet, // yes this is strange }