mirror of
https://github.com/comit-network/xmr-btc-swap.git
synced 2024-10-01 01:45:40 -04:00
Monero wallet should not know about all execution params
Instead of passing all execution params in we only make the monero_avg_block_time known to the monero wallet.
This commit is contained in:
parent
82738b111e
commit
be52892e65
@ -155,7 +155,7 @@ async fn init_wallets(
|
||||
config.monero.wallet_rpc_url.clone(),
|
||||
MONERO_NETWORK,
|
||||
DEFAULT_WALLET_NAME.to_string(),
|
||||
execution_params,
|
||||
execution_params.monero_avg_block_time,
|
||||
);
|
||||
|
||||
// Setup the Monero wallet
|
||||
|
@ -306,7 +306,7 @@ async fn init_monero_wallet(
|
||||
monero_wallet_rpc_process.endpoint(),
|
||||
monero_network,
|
||||
MONERO_BLOCKCHAIN_MONITORING_WALLET_NAME.to_string(),
|
||||
execution_params,
|
||||
execution_params.monero_avg_block_time,
|
||||
);
|
||||
|
||||
monero_wallet.open_or_create().await?;
|
||||
|
@ -1,4 +1,3 @@
|
||||
use crate::execution_params::ExecutionParams;
|
||||
use crate::monero::{
|
||||
Amount, InsufficientFunds, PrivateViewKey, PublicViewKey, TransferProof, TxHash,
|
||||
};
|
||||
@ -20,16 +19,16 @@ pub struct Wallet {
|
||||
inner: Mutex<wallet::Client>,
|
||||
network: Network,
|
||||
name: String,
|
||||
exec_params: ExecutionParams,
|
||||
avg_block_time: Duration,
|
||||
}
|
||||
|
||||
impl Wallet {
|
||||
pub fn new(url: Url, network: Network, name: String, exec_params: ExecutionParams) -> Self {
|
||||
pub fn new(url: Url, network: Network, name: String, avg_block_time: Duration) -> Self {
|
||||
Self {
|
||||
inner: Mutex::new(wallet::Client::new(url)),
|
||||
network,
|
||||
name,
|
||||
exec_params,
|
||||
avg_block_time,
|
||||
}
|
||||
}
|
||||
|
||||
@ -37,13 +36,13 @@ impl Wallet {
|
||||
client: wallet::Client,
|
||||
network: Network,
|
||||
name: String,
|
||||
exec_params: ExecutionParams,
|
||||
avg_block_time: Duration,
|
||||
) -> Self {
|
||||
Self {
|
||||
inner: Mutex::new(client),
|
||||
network,
|
||||
name,
|
||||
exec_params,
|
||||
avg_block_time,
|
||||
}
|
||||
}
|
||||
|
||||
@ -174,10 +173,8 @@ impl Wallet {
|
||||
|
||||
let address = Address::standard(self.network, public_spend_key, public_view_key.into());
|
||||
|
||||
let check_interval = tokio::time::interval(min(
|
||||
self.exec_params.monero_avg_block_time / 10,
|
||||
Duration::from_secs(1),
|
||||
));
|
||||
let check_interval =
|
||||
tokio::time::interval(min(self.avg_block_time / 10, Duration::from_secs(1)));
|
||||
let key = &transfer_proof.tx_key().to_string();
|
||||
|
||||
wait_for_confirmations(
|
||||
|
@ -603,7 +603,7 @@ async fn init_test_wallets(
|
||||
monero.wallet(name).unwrap().client(),
|
||||
monero::Network::default(),
|
||||
name.to_string(),
|
||||
execution_params,
|
||||
execution_params.monero_avg_block_time,
|
||||
);
|
||||
|
||||
let electrum_rpc_url = {
|
||||
|
Loading…
Reference in New Issue
Block a user