Move StartingBalances into protocol module

This commit is contained in:
Daniel Karzel 2021-01-20 13:29:46 +11:00
parent 41e335fc2d
commit 37f619dbfc
6 changed files with 20 additions and 14 deletions

View File

@ -56,12 +56,6 @@ pub struct SwapAmounts {
pub xmr: monero::Amount,
}
#[derive(Debug, Clone)]
pub struct StartingBalances {
pub xmr: monero::Amount,
pub btc: bitcoin::Amount,
}
// TODO: Display in XMR and BTC (not picos and sats).
impl Display for SwapAmounts {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {

View File

@ -23,9 +23,9 @@ use swap::{
config::Config,
database::Database,
monero,
protocol::{alice, bob, bob::SwapFactory},
protocol::{alice, bob, bob::SwapFactory, StartingBalances},
trace::init_tracing,
StartingBalances, SwapAmounts,
SwapAmounts,
};
use tracing::{info, log::LevelFilter};
use uuid::Uuid;

View File

@ -1,2 +1,8 @@
pub mod alice;
pub mod bob;
#[derive(Debug, Clone)]
pub struct StartingBalances {
pub xmr: crate::monero::Amount,
pub btc: bitcoin::Amount,
}

View File

@ -12,7 +12,7 @@ use crate::{
Seed as NetworkSeed,
},
protocol::bob,
StartingBalances, SwapAmounts,
SwapAmounts,
};
pub use self::{
@ -24,7 +24,10 @@ pub use self::{
state::*,
swap::{run, run_until},
};
use crate::{config::Config, database::Database, network::transport::build, seed::Seed};
use crate::{
config::Config, database::Database, network::transport::build, protocol::StartingBalances,
seed::Seed,
};
use libp2p::{core::Multiaddr, identity::Keypair};
use rand::rngs::OsRng;
use std::{path::PathBuf, sync::Arc};

View File

@ -10,7 +10,7 @@ use crate::{
database, monero, network,
network::peer_tracker::{self, PeerTracker},
protocol::{alice, bob},
StartingBalances, SwapAmounts,
SwapAmounts,
};
pub use self::{
@ -23,7 +23,10 @@ pub use self::{
state::*,
swap::{run, run_until},
};
use crate::{config::Config, database::Database, network::transport::build, seed::Seed};
use crate::{
config::Config, database::Database, network::transport::build, protocol::StartingBalances,
seed::Seed,
};
use libp2p::identity::Keypair;
use rand::rngs::OsRng;
use std::{path::PathBuf, sync::Arc};

View File

@ -9,9 +9,9 @@ use swap::{
bitcoin,
config::Config,
monero,
protocol::{alice, alice::AliceState, bob, bob::BobState},
protocol::{alice, alice::AliceState, bob, bob::BobState, StartingBalances},
seed::Seed,
StartingBalances, SwapAmounts,
SwapAmounts,
};
use tempfile::tempdir;
use testcontainers::{clients::Cli, Container};