mirror of
https://github.com/comit-network/xmr-btc-swap.git
synced 2025-08-05 21:14:32 -04:00
Add subcommand to print config
This subcommand has been introduced to make it easy for users to find the location of the deprecated sled database in case they wish to delete it. This feature should also resolve difficulties users were facing when trying to find where xmr-btc-swap was storing their data.
This commit is contained in:
parent
05a28dc37a
commit
394adb0a4f
6 changed files with 81 additions and 2 deletions
|
@ -1,10 +1,11 @@
|
|||
use crate::asb;
|
||||
use crate::bitcoin::{CancelTimelock, PunishTimelock};
|
||||
use serde::Serialize;
|
||||
use std::cmp::max;
|
||||
use std::time::Duration;
|
||||
use time::ext::NumericalStdDuration;
|
||||
|
||||
#[derive(Debug, Copy, Clone, PartialEq)]
|
||||
#[derive(Debug, Copy, Clone, PartialEq, Serialize)]
|
||||
pub struct Config {
|
||||
pub bitcoin_lock_mempool_timeout: Duration,
|
||||
pub bitcoin_lock_confirmed_timeout: Duration,
|
||||
|
@ -15,6 +16,7 @@ pub struct Config {
|
|||
pub bitcoin_network: bitcoin::Network,
|
||||
pub monero_avg_block_time: Duration,
|
||||
pub monero_finality_confirmations: u64,
|
||||
#[serde(with = "monero_network")]
|
||||
pub monero_network: monero::Network,
|
||||
}
|
||||
|
||||
|
@ -123,6 +125,23 @@ pub fn new(is_testnet: bool, asb_config: &asb::config::Config) -> Config {
|
|||
}
|
||||
}
|
||||
|
||||
mod monero_network {
|
||||
use crate::monero::Network;
|
||||
use serde::Serializer;
|
||||
|
||||
pub fn serialize<S>(x: &monero::Network, s: S) -> Result<S::Ok, S::Error>
|
||||
where
|
||||
S: Serializer,
|
||||
{
|
||||
let str = match x {
|
||||
Network::Mainnet => "mainnet",
|
||||
Network::Stagenet => "stagenet",
|
||||
Network::Testnet => "testnet",
|
||||
};
|
||||
s.serialize_str(&str)
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue