mirror of
https://github.com/comit-network/xmr-btc-swap.git
synced 2025-02-02 02:25:00 -05:00
Explicitly specify monero-wallet-rpc
deamon port
In order to allow people to plug into public nodes / be more flexible with their own setup we now enforce specifying the monero daemon port to be used by the `monero-wallet-rpc`.
This commit is contained in:
parent
343badbb4b
commit
1cdc23de32
@ -43,6 +43,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
1. Balance of ASB too low
|
1. Balance of ASB too low
|
||||||
2. Buy amount sent by CLI exceeds maximum buy amount accepted by ASB
|
2. Buy amount sent by CLI exceeds maximum buy amount accepted by ASB
|
||||||
3. ASB is running in resume-only mode and does not accept incoming swap requests
|
3. ASB is running in resume-only mode and does not accept incoming swap requests
|
||||||
|
- An issue where the monero daemon port used by the `monero-wallet-rpc` could not be specified.
|
||||||
|
The CLI parameter `--monero-daemon-host` was changed to `--monero-daemon-address` where host and port have to be specified.
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@ async fn main() -> Result<()> {
|
|||||||
monero:
|
monero:
|
||||||
Monero {
|
Monero {
|
||||||
receive_monero_address,
|
receive_monero_address,
|
||||||
monero_daemon_host,
|
monero_daemon_address,
|
||||||
},
|
},
|
||||||
tor: Tor { tor_socks5_port },
|
tor: Tor { tor_socks5_port },
|
||||||
} => {
|
} => {
|
||||||
@ -84,7 +84,7 @@ async fn main() -> Result<()> {
|
|||||||
)
|
)
|
||||||
.await?;
|
.await?;
|
||||||
let (monero_wallet, _process) =
|
let (monero_wallet, _process) =
|
||||||
init_monero_wallet(data_dir, monero_daemon_host, env_config).await?;
|
init_monero_wallet(data_dir, monero_daemon_address, env_config).await?;
|
||||||
let bitcoin_wallet = Arc::new(bitcoin_wallet);
|
let bitcoin_wallet = Arc::new(bitcoin_wallet);
|
||||||
|
|
||||||
let mut swarm = swarm::bob(&seed, seller_peer_id, tor_socks5_port).await?;
|
let mut swarm = swarm::bob(&seed, seller_peer_id, tor_socks5_port).await?;
|
||||||
@ -160,7 +160,7 @@ async fn main() -> Result<()> {
|
|||||||
monero:
|
monero:
|
||||||
Monero {
|
Monero {
|
||||||
receive_monero_address,
|
receive_monero_address,
|
||||||
monero_daemon_host,
|
monero_daemon_address,
|
||||||
},
|
},
|
||||||
tor: Tor { tor_socks5_port },
|
tor: Tor { tor_socks5_port },
|
||||||
} => {
|
} => {
|
||||||
@ -185,7 +185,7 @@ async fn main() -> Result<()> {
|
|||||||
)
|
)
|
||||||
.await?;
|
.await?;
|
||||||
let (monero_wallet, _process) =
|
let (monero_wallet, _process) =
|
||||||
init_monero_wallet(data_dir, monero_daemon_host, env_config).await?;
|
init_monero_wallet(data_dir, monero_daemon_address, env_config).await?;
|
||||||
let bitcoin_wallet = Arc::new(bitcoin_wallet);
|
let bitcoin_wallet = Arc::new(bitcoin_wallet);
|
||||||
|
|
||||||
let seller_peer_id = db.get_peer_id(swap_id)?;
|
let seller_peer_id = db.get_peer_id(swap_id)?;
|
||||||
@ -315,7 +315,7 @@ async fn init_bitcoin_wallet(
|
|||||||
|
|
||||||
async fn init_monero_wallet(
|
async fn init_monero_wallet(
|
||||||
data_dir: PathBuf,
|
data_dir: PathBuf,
|
||||||
monero_daemon_host: String,
|
monero_daemon_address: String,
|
||||||
env_config: Config,
|
env_config: Config,
|
||||||
) -> Result<(monero::Wallet, monero::WalletRpcProcess)> {
|
) -> Result<(monero::Wallet, monero::WalletRpcProcess)> {
|
||||||
let network = env_config.monero_network;
|
let network = env_config.monero_network;
|
||||||
@ -325,7 +325,7 @@ async fn init_monero_wallet(
|
|||||||
let monero_wallet_rpc = monero::WalletRpc::new(data_dir.join("monero")).await?;
|
let monero_wallet_rpc = monero::WalletRpc::new(data_dir.join("monero")).await?;
|
||||||
|
|
||||||
let monero_wallet_rpc_process = monero_wallet_rpc
|
let monero_wallet_rpc_process = monero_wallet_rpc
|
||||||
.run(network, monero_daemon_host.as_str())
|
.run(network, monero_daemon_address.as_str())
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
let monero_wallet = monero::Wallet::open_or_create(
|
let monero_wallet = monero::Wallet::open_or_create(
|
||||||
|
@ -7,8 +7,7 @@ use std::str::FromStr;
|
|||||||
use url::Url;
|
use url::Url;
|
||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
|
|
||||||
// Port is assumed to be stagenet standard port 38081
|
pub const DEFAULT_STAGENET_MONERO_DAEMON_ADDRESS: &str = "monero-stagenet.exan.tech:38081";
|
||||||
pub const DEFAULT_STAGENET_MONERO_DAEMON_HOST: &str = "monero-stagenet.exan.tech";
|
|
||||||
|
|
||||||
const DEFAULT_ELECTRUM_RPC_URL: &str = "ssl://electrum.blockstream.info:60002";
|
const DEFAULT_ELECTRUM_RPC_URL: &str = "ssl://electrum.blockstream.info:60002";
|
||||||
const DEFAULT_BITCOIN_CONFIRMATION_TARGET: &str = "3";
|
const DEFAULT_BITCOIN_CONFIRMATION_TARGET: &str = "3";
|
||||||
@ -103,11 +102,11 @@ pub struct Monero {
|
|||||||
pub receive_monero_address: monero::Address,
|
pub receive_monero_address: monero::Address,
|
||||||
|
|
||||||
#[structopt(
|
#[structopt(
|
||||||
long = "monero-daemon-host",
|
long = "monero-daemon-address",
|
||||||
help = "Specify to connect to a monero daemon of your choice",
|
help = "Specify to connect to a monero daemon of your choice: <host>:<port>",
|
||||||
default_value = DEFAULT_STAGENET_MONERO_DAEMON_HOST
|
default_value = DEFAULT_STAGENET_MONERO_DAEMON_ADDRESS
|
||||||
)]
|
)]
|
||||||
pub monero_daemon_host: String,
|
pub monero_daemon_address: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(structopt::StructOpt, Debug)]
|
#[derive(structopt::StructOpt, Debug)]
|
||||||
|
@ -115,7 +115,7 @@ impl WalletRpc {
|
|||||||
Ok(monero_wallet_rpc)
|
Ok(monero_wallet_rpc)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn run(&self, network: Network, daemon_host: &str) -> Result<WalletRpcProcess> {
|
pub async fn run(&self, network: Network, daemon_address: &str) -> Result<WalletRpcProcess> {
|
||||||
let port = tokio::net::TcpListener::bind("127.0.0.1:0")
|
let port = tokio::net::TcpListener::bind("127.0.0.1:0")
|
||||||
.await?
|
.await?
|
||||||
.local_addr()?
|
.local_addr()?
|
||||||
@ -135,8 +135,8 @@ impl WalletRpc {
|
|||||||
Network::Stagenet => "--stagenet",
|
Network::Stagenet => "--stagenet",
|
||||||
Network::Testnet => "--testnet",
|
Network::Testnet => "--testnet",
|
||||||
})
|
})
|
||||||
.arg("--daemon-host")
|
.arg("--daemon-address")
|
||||||
.arg(daemon_host)
|
.arg(daemon_address)
|
||||||
.arg("--rpc-bind-port")
|
.arg("--rpc-bind-port")
|
||||||
.arg(format!("{}", port))
|
.arg(format!("{}", port))
|
||||||
.arg("--disable-rpc-login")
|
.arg("--disable-rpc-login")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user