Remove dead code

This commit is contained in:
Franck Royer 2021-01-14 11:35:10 +11:00
parent 0852f90473
commit 31c63f0c4d
No known key found for this signature in database
GPG Key ID: A82ED75A8DFC50A4
6 changed files with 4 additions and 50 deletions

View File

@ -469,10 +469,6 @@ impl TxPunish {
} }
} }
pub fn txid(&self) -> Txid {
self.inner.txid()
}
pub fn digest(&self) -> SigHash { pub fn digest(&self) -> SigHash {
self.digest self.digest
} }

View File

@ -16,8 +16,6 @@ use crate::{
config::Config, config::Config,
}; };
pub const TX_LOCK_MINE_TIMEOUT: u64 = 3600;
#[derive(Debug)] #[derive(Debug)]
pub struct Wallet { pub struct Wallet {
pub inner: bitcoin_harness::Wallet, pub inner: bitcoin_harness::Wallet,

View File

@ -20,10 +20,9 @@ use serde::{Deserialize, Serialize};
use std::fmt::{self, Display}; use std::fmt::{self, Display};
pub mod bitcoin; pub mod bitcoin;
pub mod cli;
pub mod config; pub mod config;
pub mod database; pub mod database;
pub mod fs; mod fs;
pub mod monero; pub mod monero;
pub mod network; pub mod network;
pub mod protocol; pub mod protocol;

View File

@ -13,6 +13,7 @@
#![forbid(unsafe_code)] #![forbid(unsafe_code)]
#![allow(non_snake_case)] #![allow(non_snake_case)]
use crate::cli::{Command, Options, Resume};
use anyhow::{bail, Context, Result}; use anyhow::{bail, Context, Result};
use libp2p::{core::Multiaddr, PeerId}; use libp2p::{core::Multiaddr, PeerId};
use prettytable::{row, Table}; use prettytable::{row, Table};
@ -21,7 +22,6 @@ use std::sync::Arc;
use structopt::StructOpt; use structopt::StructOpt;
use swap::{ use swap::{
bitcoin, bitcoin,
cli::{Command, Options, Resume},
config::Config, config::Config,
database::{Database, Swap}, database::{Database, Swap},
monero, network, monero, network,
@ -34,6 +34,8 @@ use swap::{
use tracing::{info, log::LevelFilter}; use tracing::{info, log::LevelFilter};
use uuid::Uuid; use uuid::Uuid;
mod cli;
#[macro_use] #[macro_use]
extern crate prettytable; extern crate prettytable;

View File

@ -23,12 +23,6 @@ pub use wallet::Wallet;
pub const PICONERO_OFFSET: u64 = 1_000_000_000_000; pub const PICONERO_OFFSET: u64 = 1_000_000_000_000;
pub fn random_private_key<R: RngCore + CryptoRng>(rng: &mut R) -> PrivateKey {
let scalar = Scalar::random(rng);
PrivateKey::from_scalar(scalar)
}
pub fn private_key_from_secp256k1_scalar(scalar: bitcoin::Scalar) -> PrivateKey { pub fn private_key_from_secp256k1_scalar(scalar: bitcoin::Scalar) -> PrivateKey {
let mut bytes = scalar.to_bytes(); let mut bytes = scalar.to_bytes();

View File

@ -39,40 +39,5 @@ pub fn build(id_keys: identity::Keypair) -> Result<SwapTransport> {
Ok(transport) Ok(transport)
} }
/// Builds a libp2p transport with Tor and with the following features:
/// - TCP connection over the Tor network
/// - DNS name resolution
/// - authentication via noise
/// - multiplexing via yamux or mplex
pub fn build_tor(
id_keys: identity::Keypair,
address_port_pair: Option<(libp2p::core::Multiaddr, u16)>,
) -> Result<SwapTransport> {
use libp2p_tokio_socks5::Socks5TokioTcpConfig;
use std::collections::HashMap;
let mut map = HashMap::new();
if let Some((addr, port)) = address_port_pair {
map.insert(addr, port);
}
let dh_keys = noise::Keypair::<X25519Spec>::new().into_authentic(&id_keys)?;
let noise = NoiseConfig::xx(dh_keys).into_authenticated();
let socks = Socks5TokioTcpConfig::default().nodelay(true).onion_map(map);
let dns = DnsConfig::new(socks)?;
let transport = dns
.upgrade(Version::V1)
.authenticate(noise)
.multiplex(SelectUpgrade::new(
yamux::Config::default(),
MplexConfig::new(),
))
.map(|(peer, muxer), _| (peer, StreamMuxerBox::new(muxer)))
.boxed();
Ok(transport)
}
pub type SwapTransport = Boxed<(PeerId, StreamMuxerBox)>; pub type SwapTransport = Boxed<(PeerId, StreamMuxerBox)>;